0
我一直試圖在Verilog中實現全加器。我已經實施了它,並且還在Isim上展示了結果。唯一的問題是,當我嘗試使用$ monitor命令查看仿真時,它僅顯示1個結果,並非全部仿真結果。下面是測試平臺代碼:
module Full_adder_s2_testbench;
// Inputs
reg a;
reg b;
reg cin;
// Outputs
wire sum;
wire cout;
// Instantiate the Unit Under Test (UUT)
Full_adder_s2 uut (
.a(a),
.b(b),
.cin(cin),
.sum(sum),
.cout(cout)
);
integer i;
initial begin
// Initialize Inputs
a = 0;
b = 0;
cin = 0;
// Wait 100 ns for global reset to finish
#100;
end
always @ (a, b, cin)
begin
// generate truth table
for (i = 0; i < 8; i = i + 1)
// every 10 ns set a, b, and cin to the binary rep. of i
#10 {a, b, cin} = i;
$monitor("%d ns: a + b + cin = %b + %b + %b = cout sum = %b %b",
$time, a, b, cin, cout, sum);
// stop 10ns after last change of inputs
#10 $stop;
end
endmodule
這裏是導致ISIM:
運行1000 NS
模擬器是做電路初始化過程。
成品電路初始化過程。
400 ns: a + b + cin = 1 + 1 + 1 = cout sum = 1 1
結束的時刻:410納秒:在文件 「E:/ Namal/FYP /我的作品/ XILINX/Full_adder_s2/Full_adder_s2_testbench.v」 線66
我嘗試了使用$ display的兩個選項,並總是@ *,但結果仍然與上面相同。 – 2014-10-10 06:31:16
謝謝!摩根,我的問題解決了。 :) – 2014-10-10 07:29:02