Verilog Programming part 23

Examples In order to illustrate the use of behavioral constructs discussed earlier in this chapter, we consider three examples in this section. The first two, 4-to-1 multiplexer and 4-bit counter, are taken from Section | Examples In order to illustrate the use of behavioral constructs discussed earlier in this chapter we consider three examples in this section. The first two 4-to-1 multiplexer and 4-bit counter are taken from Section Examples. Earlier these circuits were designed by using dataflow statements. We will model these circuits with behavioral statements. The third example is a new example. We will design a traffic signal controller using behavioral constructs and simulate it. 4-to-1 Multiplexer We can define a 4-to-1 multiplexer with the behavioral case statement. This multiplexer was defined in Section 4-to-1 Multiplexer by dataflow statements. It is described in Example 7-35 by behavioral constructs. The behavioral multiplexer can be substituted for the dataflow multiplexer the simulation results will be identical. Example 7-35 Behavioral 4-to-1 Multiplexer 4-to-1 multiplexer. Port list is taken exactly from the I O diagram. module mux4_to_1 out i0 i1 i2 i3 s1 s0 Port declarations from the I O diagram output out input i0 i1 i2 i3 input s1 s0 output declared as register reg out recompute the signal out if any input signal changes. All input signals that cause a recomputation of out to occur must go into the always @ . sensitivity list. always @ s1 or s0 or i0 or i1 or i2 or i3 begin case s1 s0 2 b00 out i0 2 b01 out i1 2 b10 out i2 2 b11 out i3 default out 1 bx endcase end endmodule 4-bit Counter In Section Ripple Counter we designed a 4-bit ripple carry counter. We will now design the 4-bit counter by using behavioral statements. At dataflow or gate level the counter might be designed in hardware as ripple carry synchronous counter etc. But at a behavioral level we work at a very high level of abstraction and do not care about the underlying hardware implementation. We will design only functionality. The counter can be designed by using behavioral constructs as shown in Example 7-36. Notice how concise the behavioral counter description

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
Đã 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.