TAILIEUCHUNG - Modules and Ports part 1

[ Team LiB ] Modules We discussed how a module is a basic building block in Chapter 2, Hierarchical Modeling Concepts. We ignored the internals of modules and concentrated on how modules are defined and instantiated. | Team LiB Modules We discussed how a module is a basic building block in Chapter 2 Hierarchical Modeling Concepts. We ignored the internals of modules and concentrated on how modules are defined and instantiated. In this section we analyze the internals of the module in greater detail. A module in Verilog consists of distinct parts as shown in Figure 4-1. Figure 4-1. Components of a Verilog Module A module definition always begins with the keyword module. The module name port list port declarations and optional parameters must come first in a module definition. Port list and port declarations are present only if the module has any ports to interact with the external five components within a module are variable declarations dataflow statements instantiation of lower modules behavioral blocks and tasks or functions. These components can be in any order and at any place in the module definition. The endmodule statement must always come last in a module definition. All components except module module name and endmodule are optional and can be mixed and matched as per design needs. Verilog allows multiple modules to be defined in a single file. The modules can be defined in any order in the file. To understand the components of a module shown above let us consider a simple example of an SR latch as shown in Figure 4-2. Figure 4-2. SR Latch The SR latch has S and R as the input ports and Q and Qbar as the output ports. The SR latch and its stimulus can be modeled as shown in Example 4-1. Example 4-1 Components of SR Latch This example illustrates the different components of a module Module name and port list SR_latch module module SR_latch Q Qbar Sbar Rbar Port declarations output Q Qbar input Sbar Rbar Instantiate lower-level modules In this case instantiate Verilog primitive nand gates Note how the wires are connected in a cross-coupled fashion. nand n1 Q Sbar Qbar nand n2 Qbar Rbar Q endmodule statement endmodule Module name and port list Stimulus

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.