1.实验目的:
modelsim并进行仿真。
2.实验内容:
参照书中的代码,然后用modelsim,查看书中代码仿真波形是否正确。
3.实验原理:按照书中和视频上的内容,书写和运行代码,完成联合仿真操作,熟悉书中的代码运用,分析仿真结果。
4实验工具:
pc机和modlsim软件。
5.实验截图:
6.实验视频:
请下载哔哩哔哩动画打开此网址:
【Verilog书中217页,617事例-哔哩哔哩】https://b23.tv/hw7Ry3
7.实验代码:
module seqmealy(Clock, Resetn, w, z);
input Clock, Resetn, w;
output reg z;
reg [2:1]y, Y;
parameter [2:1]A = 2’b00, B = 2’b01,C= 2’b11;
// Define the next state and output combinational circuits
always @(w, y)
case(y)
A: if(w)
begin
z=0;Y=C;
end
else
begin
z=0;Y=B;
end
B: if(w)
begin
z=0;Y=C;
end
else
begin
z=1;Y=B;
end
C: if(w)
begin
z= 1;Y=C;
end
else
begin
z=0; Y=B;
end
default:
begin
z=0; Y =2’bxx;
end
endcase
// Define the sequential block
always @(negedge Resetn, posedge Clock)
if (Resetn==0) y<=A;
else y<=Y;
endmodule
实验感悟:熟悉了Verilog语言的基本运用,能够自己看懂代码,可以通过仿真图,分析正确的结果,更加懂得老师课上的理论知识。