Question

Q3. Synchronous Counter Figure 8.3(a) shows a modulo-8 synchronous up-counter (Modulo-8 because this counter can count only f

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have tried to answer the question using Verilog code. Hope it helps.

Feel free to ask if you have any querry..!!

Code for one grey cell -

module block( clk,rst ,x,y,q,r);
input clk,rst,x,y;
output reg q;
output r;
wire d;
always @ (posedge clk or posedge rst)
begin
if (rst)
q =0;
else
begin
q = d;
end
end
assign r = x && y;
assign d = (q && (~r)) || ((~q) && r);
endmodule

Code for combined module having three grey cells instantiated and connected as per the figure -

Note - Here I have used one more output naming "out" which shows the count together using three

module top( clk,rst,q0,q1,q2,out);
input clk, rst;
output q0,q1,q2;
output [2:0]out;
wire r1,r2,r3;
block b1( clk,rst ,1'b1,1'b1,q0,r1);
block b2( clk,rst ,r1,q0,q1,r2);
block b3( clk,rst ,r2,q1,q2,r3);

assign out = {q2,q1,q0};
endmodule

Test bench to check the above codes-

module top_tb;
reg clk,rst;
wire q0,q1,q2;
wire [2:0] out;
top t1( clk,rst,q0,q1,q2,out);
always
begin
clk =1; #5;
clk =0; #5;
end
initial
begin
rst =1;
#1;
rst =0;
end
endmodule

Here are the simulation results-

οττ τοτ οοτ ττο οτο του 200 τττοττ τοτ οοτ ττοοτο του και [ot]gno & Η 75 ML το ML 8 το και su 00TL su os andΡΛ. awen

Add a comment
Know the answer?
Add Answer to:
Q3. Synchronous Counter Figure 8.3(a) shows a modulo-8 synchronous up-counter (Modulo-8 because this counter can count...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT