2. Design a counter satisfying the following conditions: (20 points) a) Has a cl
ID: 2291537 • Letter: 2
Question
2. Design a counter satisfying the following conditions: (20 points) a) Has a clock input. b) Has a four-bit data output. c) Has a reset input. Whenever reset-'1', the data outputs are set to zero; d) Has a load input and four-bit data inputs. When load -'1', the data outputs are set to synchronously e) Have one-bit control inputs. when control-0, the counter is counting between 0r8; w the counter is counting between 0r9; ) Reset has the highest priority, After clock signal, load has the second highest prioritya priority.Explanation / Answer
module counter(clock, reset,control,load,in, out) ;
input clock, reset, control,load ;
input [3:0] in;
output [3:0] out ;
reg [3:0] out ;
always@(posedge clock )
begin
if (reset)
out=4'b0000;
else if(load)
out=in;
else
if(control)
if(out<8)
out=out+1;
else
out=0;
else
if(out<9)
out=out+1;
else
out=0;
end
endmodule
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.