mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-29 01:03:29 +02:00
By adding ivtest to the iverilog source tree, it is easier to keep the regression test synchronized with the source that is being tested. This should be especially helpful for PRs that add a new feature, and have a matching ivtest PR with the regression test for that feature.
43 lines
1.2 KiB
Verilog
43 lines
1.2 KiB
Verilog
/* dcomp1.v - this is a fragment of a larger program, which would
|
|
* dynamicly compute a more interesting value for the phdelay variable.
|
|
*
|
|
* It illustrates a problem in verilog-20010721 when computing
|
|
* time values for use in behavioral delays.
|
|
*/
|
|
`timescale 1ps / 1ps
|
|
module dcomp;
|
|
time phdelay;
|
|
parameter clk_period = 400;
|
|
parameter phoffset = 4;
|
|
time compdelay;
|
|
reg internal_Clk, Clk;
|
|
|
|
initial begin
|
|
$monitor("%b %b %t %t %t", internal_Clk, Clk, phdelay, compdelay, $time);
|
|
phdelay = 0;
|
|
#2000;
|
|
phdelay = 13;
|
|
#2001;
|
|
$finish(0);
|
|
end // initial begin
|
|
|
|
initial internal_Clk <= 0;
|
|
always #(clk_period/2) internal_Clk = ~internal_Clk;
|
|
|
|
always @(internal_Clk) begin
|
|
// uncoment only one of the next four lines:
|
|
// #(phdelay); // works
|
|
// #(phdelay + phoffset); // fails
|
|
compdelay = phdelay + phoffset; #(compdelay); // fails
|
|
// compdelay = phdelay + 4; #(compdelay); // fails
|
|
|
|
$display("got here");
|
|
|
|
Clk <= internal_Clk;
|
|
|
|
// of course, this is what I really want... (but that's PR#105)
|
|
// Clk <= #(phdelay + phoffset + clk_period/2) internal_Clk;
|
|
end // always @ (internal_Clk)
|
|
|
|
endmodule // dcomp
|