(B) Counter-Decoder Type Controllers Implement The...
(B) Counter-Decoder Type Controllers Implement The...
com
home / study / engineering / electrical engineering / electrical engineering questions and answers / (b) counter-decoder type controllers impleme…
Question: (B) Counter-Decoder Type Controllers Implement the counter-… Post a question
Answers from our experts for your tough
homework questions
(1 bookmark)
Continue to post
9 questions remaining
888-888-8888 Text me
My Textbook Solutions
Expert Answer
Verilog code:
//Verilog code
`timescale 1ns / 1ps
module RTL_FSM_VERILOG(
input clock,
input Stop,
output Out,
https://www.chegg.com/homework-help/questions-and-answers/b-counter-decoder-type-controllers-implement-counter-decoder-circuit-using-rtl-verilog… 1/4
5/2/2021 (B) Counter-Decoder Type Controllers Implement The... | Chegg.com
output [3:0] CountOut
); Textbook Solutions Expert Q&A Practice Study Pack
//internal registers
//as we have 8 states , we need atleast 4 bits to store state value
reg [3:0] PS=4'd0; // PS => Present state, it is initialized to S0
wire [3:0] NS; //NS => Next
//output's
assign CountOut = PS; //state count
assign Out = ( PS == 4'b0010) ? 1'b1 : 1'b0; //Out = 1 only in state 2
endmodule
//code ends
test bench:
//Test bench
`timescale 1ns / 1ps
module TB_RTL_FSM_VERILOG();
reg clock;
reg Stop;
wire Out;
wire [3:0] CountOut;
//uut
RTL_FSM_VERILOG R1 (
.clock(clock),
.Stop(Stop),
.Out(Out),
.CountOut(CountOut)
);
//clock generation
initial begin
clock=1'b0; //50 MHz clock
forever #10 clock=!clock; //clock period=20ns
end
//stimulus
initial begin
Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
#25 Stop = 1;
https://www.chegg.com/homework-help/questions-and-answers/b-counter-decoder-type-controllers-implement-counter-decoder-circuit-using-rtl-verilog… 2/4
5/2/2021 (B) Counter-Decoder Type Controllers Implement The... | Chegg.com
#15 Stop = 0;
#25 Stop = 1;
#15 Stop = 0;
Textbook Solutions Expert Q&A Practice Study Pack
#20 $ nish;
end
endmodule
//test bench ends
//OUTPUT WAVEFORMS
***END
Comment
Q: RTL Verilog, Verify circuit functionality Include design and test bench
A: See answer
Show more
COMPANY
CHEGG NETWORK
https://www.chegg.com/homework-help/questions-and-answers/b-counter-decoder-type-controllers-implement-counter-decoder-circuit-using-rtl-verilog… 3/4
5/2/2021 (B) Counter-Decoder Type Controllers Implement The... | Chegg.com
CUSTOMERSERVICE Textbook Solutions Expert Q&A Practice Study Pack
https://www.chegg.com/homework-help/questions-and-answers/b-counter-decoder-type-controllers-implement-counter-decoder-circuit-using-rtl-verilog… 4/4