Write Verilog code to test a Mealy sequential circuit with one input (X) and one output (Z).

Question:

Write Verilog code to test a Mealy sequential circuit with one input (X) and one output (Z). The code should include the Mealy circuit as a component. Assume the Mealy circuit changes state on the rising edge of CLK. Your test code should generate a clock with a 100-ns period. The code should apply the following test sequence:

X = 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0


X should change 10 ns after the rising edge of CLK. Your test code should read Z at an appropriate time and should verify that the following output sequence was generated:


Z = 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0


Report an error if the output sequence from the Mealy circuit is incorrect; otherwise, report “sequence correct.” Complete the following architecture for the tester:
module tester;
reg CLK;reg[11:0]X;
reg[11:0]Z;
initial
begin
X = 12'b011011011100;
Z = 12'b100110110110;
CLK = 1;
end
.
.
.
.
.
endmodule

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Digital Systems Design Using Verilog

ISBN: 978-1285051079

1st edition

Authors: Charles Roth, Lizy K. John, Byeong Kil Lee

Question Posted: