MODULE 4-BITCOUNTER ( CLK,RSTN,REG[3:0] OUT1);
INPUT CLK,RETN;
OUTPUT REG;
integer n;
always @ (posedge CLK)
begin
for(n=0;n<=3,n++)
begin
if(!rstn)
{
out<=0;
}
else
{
out<=out+1;
}
end
end
endmodule
bas Q3) Write a Verilog description of a 4-bit counter with asynchronous reset that has two...
Write a behavioral Verilog module for a 4-bit Johnson counter that has 8 states. The counter loads the "0000" state if reset is low. The counter should start and end with this state. Write a testbench to verify the correctness of the 4-bit Johnson counter. The testbenclh should have a clock with a period of 20ns and a reset signal. The testbench should store the 4-bit binary outputs of the counter in a file, which will be used to provide...
1) Using Verilog behavioral modeling, describe an n-bit circuit that has four n-bit unsigned inputs A B, C, and D, and two control inputs C1, and CO. The circuit produces an n+1-bit output Y according to the following table: (No delavs) 120 marks CI CO Function 1 Y MAX (A,B,C,D) , i.e. Y equals the maximum of the four inputs 0 | Y 〈 MIN (A,B,C,D), i.e. Y, equals the minimum of the four inputs 1 YAVERAGE (A,B.C,D), i.e. Y...
1) Using Verilog behavioral modeling, describe an n-bit circuit that has four n-bit unsigned inputs A B, C, and D, and two control inputs C1, and CO. The circuit produces an n+1-bit output Y according to the following table: (No delavs) 120 marks CI CO Function 1 Y MAX (A,B,C,D) , i.e. Y equals the maximum of the four inputs 0 | Y 〈 MIN (A,B,C,D), i.e. Y, equals the minimum of the four inputs 1 YAVERAGE (A,B.C,D), i.e. Y...
Design in VHDL a 4-bit up-down counter as presented below: The operation of the up-down counter is described by the following truth table: S1 S0 Action 0 0 Hold 0 1 Count up 1 0 Count down 1 1 Parallel Load Provide VHDL code and testbench XЗ Q3 X3X2X1X0 Parallel Load X2 S1SO Function Select Input Q2 RST-Asynchronous Reset Input X1 CLK- Clock Input Q1 хо Q3Q2Q1Q0 - Parallel Output Q0 CLK S1 S0 RST XЗ Q3 X3X2X1X0 Parallel Load...
verilog code needed for the counter using the JK flip flop please include the testbench, thanks! Successfully completing a System Verilog +80Pts. Implementation showing the full sequence of ABC readouts Pre-Laboratory Exercise: You are to design a counter that will count through a sequence either forward or reverse. You will have two control inputs: Direction, and Reset'. Sequence #2: 000 100 110 111 101001 → 011 010 → 000... {Gray code} When Direction=0 follow the order listed above. When Direction...
Use a behavioral Verilog model to design a 3-bit fault tolerant up-down counter. For each flip-flop (FF) include asynchronous reset and preset signals. Refer to Example 4.3 on page 160 for an example of a single FF with both reset and preset signals as well as with an enable signal. For this project, you don't need to use FFs with enables. You don't also need not-q (nq) in this assignment. Use active-high signals for reset and present signals. The example...
The task is to design a two-bit controlled counter which has two counting bits (Q2, Q1), has one control input C1, and also two extra outputs, one indicating overflow, the other underflow. When C1=0 the counter counts up by 2s; i.e. 0 becomes 2, 1 becomes 3. In this mode the values 2 and 3 go to the overflow state. When the control input C1=1, the counter counts down by 2s, i.e. 3 becomes 1, and 2 becomes 0, and...
Q3. Synchronous Counter Figure 8.3(a) shows a modulo-8 synchronous up-counter (Modulo-8 because this counter can count only from 0 to 7 with its 3 bits qo, q1 and 92.). Treat each gray cell in the figure as a component and write generic VHDL codes to create a modulo-2N counter, where N is the number of flip-flops required. Use nominal mapping for this problem while instantiating components. When the asynchronous reset signal rst is high, the counter is set to 0...
5. (7 points) Shown in the following block diagram is a 4-bit up-counter with parallel load, clk Dc BA load clr where clr and load are asynchronous inputsi.e., one of the following operations will be performed “simultaneously" (independently of the clock) when the inputs change values: clr load operations 1 X clear 0 0parallel load 1 up-counting 0 the above block diagram and any logic gates you want to build an offset down-counter to count from QpQcQBQA 0111 0110010 ....
Consider the circuit in Figure 1. It is a 4-bit (QQ2Q3) synchronous counter which uses four T-type flip-flops. The counter increases its value on each positive edge of the clock if the Enable signal is asserted. The counter is reset to 0 by setting the Clear signal low. You are to implement an 8-bit counter of this type Enable T Q Clock Clear Figure 1. 4-bit synchronous counter (but you need to implement 8-bit counter in this lab) Specific notes:...