reg [3:0] DataA,DataB; reg IAGB,IASB,IAEB; wire QAGB,QASB,QAEB; integer I;
HC85 testbench85(DataA,DataB,QAGB,QASB,QAEB,IAGB,IASB,IAEB); initial begin DataA=0; repeat(20)
#20 DataA=$random; end initial begin DataB=0; repeat(20)
#20 DataB=$random; end initial begin
for((I=0;I<8;I=I+1)) {IAGB,IASB,IAEB}=I; #20; end
endmodule
//74HC283代码
module HC283(DataA,DataB,Cin,Sum,Cout); input [3:0] DataA,DataB; input Cin;
output [3:0]Sum; reg [3:0]Sum; output Cout; reg Cout;
always @(DataA,DataB,Cin) begin
{Cout,Sum}=DataA+DataB+Cin; end
endmodule
//74HC283测试平台代码 `timescale 1ns/10ps module testbench;
reg [3:0] DataA,DataB;
12
reg Cin;
wire [3:0]Sum; wire Cout;
HC283 testbench283(DataA,DataB,Cin,Sum,Cout); initial begin DataA=0; repeat(20)
#20 DataA=$random; end initial begin DataB=0; repeat(20)
#40 DataB=$random; end initial begin Cin=0;
#200 Cin=1; end
endmodule
//74HC4511代码
module HC4511(A,Seg,LTN,BIN,LE); input LTN,BIN,LE; input[3:0]A; output[7:0]Seg;
always @(A,LTN,BIN,LE) begin
if(!LTN) Seg=8`b11111111; else if(!BIN) Seg=8`b00000000; else if(LE) Seg=Seg; else
case(A)
4`d0:Seg=8`b00111111; 4`d1:Seg=8`b00000110; 4`d2:Seg=8`b01011011; 4`d3:Seg=8`b01001111; 4`d4:Seg=8`b01100110; 4`d5:Seg=8`b01101101; 4`d6:Seg=8`b01111101; 4`d7:Seg=8`b00000111;
13
4`d8:Seg=8`b01111111; 4`d9:Seg=8`b01101111; 4`d10:Seg=8`b01110111; 4`d11:Seg=8`b01111100; 4`d12:Seg=8`b00111001; 4`d13:Seg=8`b01011110; 4`d14:Seg=8`b01111001; 4`d15:Seg=8`b01110001; default; endcase end
endmodule
//74HC4511测试平台代码 `timescale 1ns/10ps module testbench; reg LTN,BIN,LE; reg[3:0]A; wire[7:0]Seg;
HC4511 testbench4511(A,Seg,LTN,BIN,LE); initial begin A=0;
repeat(20)
#10 A=$random; end initial begin
LTN=0;#10
BIN=0;LTN=1; #10 LE=0;BIN=1; #10; end
endmodule
2、第一次仿真结果(任选一个模块,请注明) 解:选择74HC148:
14
3、综合结果
4、第二次仿真结果(综合后)。回答输出信号是否有延迟,延迟时间约为多少?
有延迟,延迟时间约为300ps。 5、第三次仿真结果(布局布线后)。回答输出信号是否有延迟,延迟时间约为多少?分析是否有出现竞争冒险。
15