下面是我的addr4.v和testbench
module addr4 (a, b, cin, s, cout,vddl,vssl);
input [3:0] a, b;
input cin;
output [3:0] s;
output cout;
input vddl;
input vssl;
//assign {cout, s} = a + b + cin;
endmodule
`timescale 1ns/10ps
module top;
reg [3:0] a, b;
wire [3:0] s;
reg cin;
wire cout;
task test;
input [3:0] in1, in2;
input inc;
reg [3:0] real_out, exp_out;
reg real_cout, exp_cout ;
reg vddl;
reg vssl;
begin
vddl=1'b1;
vssl=1'b0;
a = in1;
b = in2;
cin = inc;
#10
real_out = s;
real_cout = cout;
assign {exp_cout, exp_out} = in1 + in2 + inc;
if ($test$plusargs("COMPARE")) begin
if (exp_out !== real_out)
$display("COMPARE ERROR! Expected_s=%h Real_s=%h",exp_out,real_out);
if (exp_cout !== real_cout)
$display("COMPARE ERROR! Expected_cout=%b Real_cout=%b",exp_cout,real_cout);
end
end
endtask
adder4 dut (.a(a[3:0]), .b(b[3:0]), .cin(cin), .s(s[3:0]), .cout(cout), .vssl(vssl), .vddl(vddl));
initial begin
$vcdpluson;
$monitor($time,,,"a= %h ",a,"b= %h ",b,"cin= %b ",cin,"s= %h ",s,"cout= %b ",cout);
#0
//test(ValueForInput1, ValueForInput2, CarryIn);
test(0,1,0);
test(0,1,1);
test(1,1,1);
test(15,15,0);
test(15,15,1);
$finish(2);
end
endmodule
AD.init设置如下,加入了加法器的网表
bus_format <%d>;
use_spice -cell adder4;
choose xa -spectre /home/rfic/TEST/input.scs -c /home/rfic/TEST/aa.cfg
d2a hiv=1.8V lov=0V node=top.dut.a<0>;
d2a hiv=1.8V lov=0V node=top.dut.a<1>;
d2a hiv=1.8V lov=0V node=top.dut.a<2>;
d2a hiv=1.8V lov=0V node=top.dut.a<3>;
d2a hiv=1.8V lov=0V node=top.dut.b<0>;
d2a hiv=1.8V lov=0V node=top.dut.b<1>;
d2a hiv=1.8V lov=0V node=top.dut.b<2>;
d2a hiv=1.8V lov=0V node=top.dut.b<3>;
d2a hiv=1.8V lov=0V node=top.dut.cin;
a2d loth=0.9V hith=0.9V node=top.dut.s<0>;
a2d loth=0.9V hith=0.9V node=top.dut.s<1>;
a2d loth=0.9V hith=0.9V node=top.dut.s<2>;
a2d loth=0.9V hith=0.9V node=top.dut.s<3>;
a2d loth=0.9V hith=0.9V node=top.dut.cout;
d2a hiv=1.8V lov=0V node=top.dut.vssl;
d2a hiv=1.8V lov=0V node=top.dut.vddl;
请问大佬们,我的这个流程是哪里出问题了呢 |