Encore SIM EDITOR SOFTWARE Podręcznik Użytkownika Strona 71

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 149
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 70
2-3
Modeling Your Design
end
initial begin
#10 if (a) $display("may not print");
end
endmodule
The solution is to delay the $display statement with a #0 delay:
initial begin
#10 if (a)
#0 $display("may not print");
end
You can also move it to the next time step with a non-zero delay.
Setting a Value Twice at the Same Time
In this example, the race condition occurs at time 10 because no
ordering is guaranteed between the two parallel initial blocks.
module race;
reg r1;
initial #10 r1 = 0;
initial #10 r1 = 1;
initial
#20 if (r1) $display("may not print");
endmodule
The solution is to stagger the assignments to register r1 by finite
time, so that the ordering of the assignments is guaranteed. Note that
using the nonblocking assignment (<=) in both assignments to r1
would not remove the race condition in this example.
Przeglądanie stron 70
1 2 ... 66 67 68 69 70 71 72 73 74 75 76 ... 148 149

Komentarze do niniejszej Instrukcji

Brak uwag