Question

A 4-Bit binary counter: A register containing 4 bits, all initialized to zero. The bits increment...

A 4-Bit binary counter: A register containing 4 bits, all initialized to zero. The bits increment by 1 every 10 nanoseconds at each iteration until it gets to all ones in the 4-bit positions.

Write the Verilog code and testbench for the 4-bit binary counter.

Homework Answers

Answer #1
Verilog code with testbench:

module counter_tb;



reg clk;

wire [3:0] y;



counter uut {

 .clk(clk);

.reset (reset);

.y (y);

};

initial begin

clk = 1; reset = 1; #100;

clk = 1; reset = 0; #100;



end

alwasy $10 clk = ~clk;

endmodule
Let me know if you have any doubts or if you need anything to change. 

If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.

Thank You!
===========================================================================
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
a) Draw the additional connections required for a 4-bit binary counter to go through the count...
a) Draw the additional connections required for a 4-bit binary counter to go through the count sequence 5-to-14 then repeats using the Load signal. b) Write the Verilog-HDL that describes the behaviour of the counter of part a).
Using T-Flip-flops, design a 3-bit register/counter circuit with bits [A2 A1 A0]. The circuit operations are...
Using T-Flip-flops, design a 3-bit register/counter circuit with bits [A2 A1 A0]. The circuit operations are described in the following table. Show all design details, i.e., write down steps and equations and draw the detailed circuit diagram. S2 S1 S0 Operation 0 0 0 No change 0 0 1 Rotate left 0 1 0 Rotate right 0 1 1 Reset 1 0 0 Set 1 0 1 Count down 1 1 0 Count up 1 1 1 Load external bits...
A set of parity-check equations for a distance-4 Hamming code with 64 data bits and 8...
A set of parity-check equations for a distance-4 Hamming code with 64 data bits and 8 parity-check bits are specified by the eight 72-bit constants below, each representing one row the parity-check matrix: C[1] = 72'h80000000000000007f; C[2] = 72'h400000003FFFFFFF80; C[3] = 72'h20001FFFC0007FFF80; C[4] = 72'h100FE03FC07F807F80; C[5] = 72'h0871E3C3C78787878F; C[6] = 72'h04B66CCCD9999999B3; C[7] = 72'h02DAB5556AAAAAAAD5; C[8] = 72'hFFFFFFFFFFFFFFFFFF; Assuming that bits are numbered D[17:0], bits D[71:64] are the check bits, D[63:0] are the data bits. Write a Verilog model for a...
QUESTION 1 During a single clock tick, how many 64-bit values can be written to an...
QUESTION 1 During a single clock tick, how many 64-bit values can be written to an input of a register file with 8 64-bit registers (i.e. an 8x64 register file)? QUESTION 2 Suppose you are designing a processor that contains a register file with 32 32-bit registers (i.e. a 32x32 register file). What is the minimum number of bits required in order to select which register is being written to? QUESTION 3 If the decimal value, 30, is shifted to...
Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in...
Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in BL. Bits 6-7 in BL should be cleared, and AL should be unchanged             Mov al, bl       And 00111111, bl       Write a sequence of two instructions that copies the integer in bits 4-7 from AL register into bits 0-3 of the BL register. Upper 4 bits of AL and BL will be cleared             Shr al, 4       Mov bl,...
VERILOG Design an Arithmetic Logic Unit (ALU) that can perform four-bit 1. Four-bit addition; 2. Four-bit...
VERILOG Design an Arithmetic Logic Unit (ALU) that can perform four-bit 1. Four-bit addition; 2. Four-bit subtraction; 3. Four-bit multiplication; 4. Four-bit comparator (that compares two binary numbers to check whether two numbers are equal, or one is less/greater than other). Write test benches and simulate each module/submodule. Hint: First make individual modules of the four-bit adder, four-bit subtractor, four-bit multiplier, four-bit comparator modules (make all these in same/one project) and then use a multiplexer to combine these modules to...
Adder Start out by picking 2 positive six bit binary numbers that are less than 3210,...
Adder Start out by picking 2 positive six bit binary numbers that are less than 3210, written in 2's complement notation. The eventual goal is to add these two numbers. 1) Look at the LSB bit of the numbers, and using logic gates (NANDs, NORs, etc.) design a circuit that correctly gives the right output for any possible combination of bits in the LSB place. 2) Now look at the next column to the left (next to LSB). In this...
In MPLAB XIDE create a program using assembly to produce three different LED combinations using 4...
In MPLAB XIDE create a program using assembly to produce three different LED combinations using 4 LED lights and 4 switches that correspond to each LED. There will be 4 inputs and 4 outputs. The program includes three levels (the three LED combinations). Each level will be a random combination (i.e. red, blue, green, orange). The player will then repeat the combinations as accurately as possible. If the player repeats the led sequence correctly, the code will branch to the...
This assignment involves using a binary search tree (BST) to keep track of all words in...
This assignment involves using a binary search tree (BST) to keep track of all words in a text document. It produces a cross-reference, or a concordance. This is very much like assignment 4, except that you must use a different data structure. You may use some of the code you wrote for that assignment, such as input parsing, for this one. Remember that in a binary search tree, the value to the left of the root is less than the...
NWS620S Tutorial 1: Symmetric Encryption - DES Encryption is the translation of data into a secret...
NWS620S Tutorial 1: Symmetric Encryption - DES Encryption is the translation of data into a secret code so that only authorised entities can read it. Encrypting data is considered a very effective way of achieving data security. To access encrypted data, you must have access to a secret key that enables you to decrypt it. Unencrypted data is called plain text; encrypted data is referred to as cipher text. There are two types of encryption: • Symmetric encryption • Asymmetric...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT