kvnsmnsn
Junior Member level 1

I've got a piece of Verilog that calculates (aOp*bOp+cOp):
How do I check for timing, assuming that the delay of each nmos is 2 time units and the delay for each pmos is 2 time units? I tried writing:
but the compiler doesn't like that. My test code is:
I'd just like to figure out how I can test the timing on this.
Sorry for the typos!
Code:
module Tf ( output rslt
, input aOp
, bOp
, cOp);
supply0 ground;
supply1 power;
wire a_b;
wire ab_c;
nmos na( a_b , ground, aOp);
nmos nb( rslt, a_b , bOp);
nmos nc( rslt, ground, cOp);
pmos pa( ab_c, power , aOp);
pmos pb( ab_c, power , bOp);
pmos pc( rslt, ab_c , cOp);
endmodule
Code:
#2 nmos na( a_b , ground, aOp);
#2 nmos nb( rslt, a_b , bOp);
#2 nmos nc( rslt, ground, cOp);
#2 pmos pa( ab_c, power , aOp);
#2 pmos pb( ab_c, power , bOp);
#2 pmos pc( rslt, ab_c , cOp);
Code:
// (c) Kevin Simonson 2025
module t_Tf;
reg aOp;
reg bOp;
reg cOp;
wire rslt;
Tf f( rslt, aOp, bOp, cOp);
initial
begin
aOp = 1'b0; bOp = 1'b0; cOp = 1'b0;
#10 cOp = 1'b1;
#10 bOp = 1'b1; cOp = 1'b0;
#10 cOp = 1'b1;
#10 aOp = 1'b1; bOp = 1'b0; cOp = 1'b0;
#10 cOp = 1'b1;
#10 bOp = 1'b1; cOp = 1'b0;
#10 cOp = 1'b1;
#10 $finish;
end
always @( aOp, bOp, cOp, rslt)
begin
$display
( "t: %2t, aOp: %1b, bOp: %1b, cOp: %1b"
, $time , aOp , bOp , cOp);
end
endmodule
--- Updated ---
Oops! I meant it calculates ((aOp*bOp+cOp)'), and the test code is actually:I've got a piece of Verilog that calculates (aOp*bOp+cOp):
How do I check for timing, assuming that the delay of each nmos is 2 time units and the delay for each pmos is 2 time units? I tried writing:Code:module Tf ( output rslt , input aOp , bOp , cOp); supply0 ground; supply1 power; wire a_b; wire ab_c; nmos na( a_b , ground, aOp); nmos nb( rslt, a_b , bOp); nmos nc( rslt, ground, cOp); pmos pa( ab_c, power , aOp); pmos pb( ab_c, power , bOp); pmos pc( rslt, ab_c , cOp); endmodule
but the compiler doesn't like that. My test code is:Code:#2 nmos na( a_b , ground, aOp); #2 nmos nb( rslt, a_b , bOp); #2 nmos nc( rslt, ground, cOp); #2 pmos pa( ab_c, power , aOp); #2 pmos pb( ab_c, power , bOp); #2 pmos pc( rslt, ab_c , cOp);
I'd just like to figure out how I can test the timing on this.Code:// (c) Kevin Simonson 2025 module t_Tf; reg aOp; reg bOp; reg cOp; wire rslt; Tf f( rslt, aOp, bOp, cOp); initial begin aOp = 1'b0; bOp = 1'b0; cOp = 1'b0; #10 cOp = 1'b1; #10 bOp = 1'b1; cOp = 1'b0; #10 cOp = 1'b1; #10 aOp = 1'b1; bOp = 1'b0; cOp = 1'b0; #10 cOp = 1'b1; #10 bOp = 1'b1; cOp = 1'b0; #10 cOp = 1'b1; #10 $finish; end always @( aOp, bOp, cOp, rslt) begin $display ( "t: %2t, aOp: %1b, bOp: %1b, cOp: %1b" , $time , aOp , bOp , cOp); end endmodule
Code:
// (c) Kevin Simonson 2025
module t_Tf;
reg aOp;
reg bOp;
reg cOp;
wire rslt;
Tf f( rslt, aOp, bOp, cOp);
initial
begin
aOp = 1'b0; bOp = 1'b0; cOp = 1'b0;
#10 cOp = 1'b1;
#10 bOp = 1'b1; cOp = 1'b0;
#10 cOp = 1'b1;
#10 aOp = 1'b1; bOp = 1'b0; cOp = 1'b0;
#10 cOp = 1'b1;
#10 bOp = 1'b1; cOp = 1'b0;
#10 cOp = 1'b1;
#10 $finish;
end
always @( aOp, bOp, cOp, rslt)
begin
$display
( "t: %2t, aOp: %1b, bOp: %1b, cOp: %1b, rslt: %1b"
, $time , aOp , bOp , cOp , rslt);
end
endmodule
Last edited: