网站title优化,网页app制作教程,城关区建设局网站,阿里云做电影网站完成课本例题4.12#xff0c;进行综合和仿真#xff08;包括功能仿真和时序仿真#xff09;#xff0c;查看仿真结果#xff0c;将Verilog代码和仿真波形图整理入实验报告。
功能文件#xff1a;
module shiyan1(out,reset,clk);
input reset,clk;
output reg[3:0] ou…完成课本例题4.12进行综合和仿真包括功能仿真和时序仿真查看仿真结果将Verilog代码和仿真波形图整理入实验报告。
功能文件
module shiyan1(out,reset,clk);
input reset,clk;
output reg[3:0] out;
always (posedge clk)
begin
if(reset)
out0;
else
outout1;
end
endmodule
测试文件
timescale 1ns/1ns module test2();
reg clk,reset;
wire[3:0] out;
parameter DELY100;
shiyan1 U1(out,reset,clk);
always #(DELY/2) clk~clk;
initial
begin clk 0;reset0;
#DELY reset1;
#DELY reset0;
#(DELY*20) $finish;
end
initial $monitor($time,,,clk%d reset%d out%d,clk,reset,out);
endmodule 课后习题4.1用Verilog设计一个8位加法器进行功能仿真查看综合和仿真结果将Verilog代码和仿真波形图整理入实验报告。
功能代码:
module a(a,b,ci,sum,co);
input [7:0] a,b;
input ci;
output [7:0] sum;
output co;
reg sum,co;
assign {co,sum}abci;
Endmodule 测试代码:
timescale 1ns/1ns module test5();
reg[7:0] a,b;
reg ci;
wire[7:0] sum;
wire co;
integer i,j;
a U4(a,b,ci,sum,co);
always #10 ci~ci;
initial begin a0;b0;ci0;
for(i1;i16;ii1)
#10 ai;
end
initial
begin for(j1;j16;jj1)
#10 bj;
end
initial
begin
#160 $finish;
end
Endmodule