Verilog Programming part 3

Instances A module provides a template from which you can create actual objects. When a module is invoked, Verilog creates a unique object from the template. | Instances A module provides a template from which you can create actual objects. When a module is invoked Verilog creates a unique object from the template. Each object has its own name variables parameters and I O interface. The process of creating objects from a module template is called instantiation and the objects are called instances. In Example 2-1 the top-level block creates four instances from the T-flipflop T_FF template. Each T_FF instantiates a D_FF and an inverter gate. Each instance must be given a unique name. Note that is used to denote singleline comments. Example 2-1 Module Instantiation Define the top-level module called ripple carry counter. It instantiates 4 T-flipflops. Interconnections are shown in Section 4-bit Ripple Carry Counter. module ripple_carry_counter q clk reset output 3 0 q I O signals and vector declarations will be explained later. input clk reset I O signals will be explained later. Four instances of the module T_FF are created. Each has a unique instance is passed a set of signals. Notice that each instance is a copy of the module T_FF. T_FF tff0 q 0 clk reset T_FF tff1 q 1 q 0 reset T_FF tff2 q 2 q 1 reset T_FF tff3 q 3 q 2 reset endmodule Define the module T_FF. It instantiates a D-flipflop. We assumed that module D-flipflop is defined elsewhere in the design. Refer to Figure 2-4 for interconnections. module T_FF q clk reset Declarations to be explained later output q input clk reset wire d D_FF dff0 q d clk reset Instantiate D_FF. Call it dff0. not n1 d q not gate is a Verilog primitive. Explained later. endmodule In Verilog it is illegal to nest modules. One module definition cannot contain another module definition within the module and endmodule statements. Instead a module definition can incorporate copies of other modules by instantiating them. It is important not to confuse module definitions and instances of a module. Module definitions simply specify how the module will work its internals and its .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU LIÊN QUAN
5    176    1
5    255    1
5    106    0
5    121    1
6    103    1
6    107    1
6    121    1
6    103    0
6    140    0
TÀI LIỆU MỚI ĐĂNG
27    289    2    20-05-2024
Đã 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.