TAILIEUCHUNG - Verilog Programming part 27

Tasks and functions are used to define common Verilog functionality that is used at many places in the design. | Summary In this chapter we discussed tasks and functions used in behavior Verilog modeling. Tasks and functions are used to define common Verilog functionality that is used at many places in the design. Tasks and functions help to make a module definition more readable by breaking it up into manageable subunits. Tasks and functions serve the same purpose in Verilog as subroutines do in C. Tasks can take any number of input inout or output arguments. Delay event or timing control constructs are permitted in tasks. Tasks can enable other tasks or functions. Re-entrant tasks defined with the keyword automatic allow each task call to operate in an independent space. Therefore re-entrant tasks work correctly even with concurrent tasks calls. Functions are used when exactly one return value is required and at least one input argument is specified. Delay event or timing control constructs are not permitted in functions. Functions can invoke other functions but cannot invoke other tasks. A register with name as the function name is declared implicitly when a function is declared. The return value of the function is passed back in this register. Recursive functions defined with the keyword automatic allow each function call to operate in an independent space. Therefore recursive or concurrent calls to such functions will work correctly. Tasks and functions are included in a design hierarchy and can be addressed by hierarchical name referencing. Team LiB Team LiB Exercises 1 Define a function to calculate the factorial of a 4-bit number. The output is a 32-bit value. Invoke the function by using stimulus and check results. 2 Define a function to multiply two 4-bit numbers a and b. The output is an 8-bit value. Invoke the function by using stimulus and check results. 3 Define a function to design an 8-function ALU that takes two 4-bit numbers a and b and computes a 5-bit result out based on a 3-bit select signal. Ignore overflow or underflow bits. Select Signal .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.