module top;
wire c_out;
parameter width=8;
reg [width-1:0]a,b;
wire [width-1:0]sum;
integer a1,b1;
initial
begin
for(a1=0;a1<(1<< );a1=a1+1)
begin
for (b1=0;b1<(1<< );b1=b1+1)
begin
{b}=b1;
{a}=a1;
#1;
end
end
$finish;
end
system_clock #200 clock3(c_in);
adder xxx(sum,c_out,a,b,c_in);
endmodule
module adder(sum,c_out,a,b,c_in);
parameter width=8;
input [width-1:0]a,b;
input c_in;
output [width-1:0]sum;
output c_out;
wire [width-1:0]sum;
wire c_out;
assign {c_out,sum}=a+b+c_in;
endmodule
module system_clock(clk);
parameter PERIOD=100;
output clk;
reg clk;
initial
clk=0;
always
begin
#(PERIOD/2)clk=~clk;
#(PERIOD-PERIOD/2)clk=~clk;
end
always@(posedge clk)if($time>100000000)#(PERIOD-1)$stop;
endmodule
沒有留言:
張貼留言