verilog behavioral modeling--sequential and parallel statements

1.Sequential statement groups

the begin-end keywords:

.group several statements togethor

.cause the statements to be evaluated sequentially(one at a time)

*any timing within the sequential groups is relative to the previous statement

*delays in the sequential accumulate(each delay is added to the previous delay)

*block finishes after the last statement in the block

Example - sequential
  1 module sequential();
  2
  3 reg a;
  4
  5 initial begin
  6   $monitor ("%g a = %b", $time, a);
  7    #10 a = 0;
  8    #11 a = 1;
  9    #12 a = 0;
10    #13 a = 1;
11    #14 $finish;
12 end
13
14 endmodule

 
Simulator Output

 
 0 a = x
 10 a = 0
 21 a = 1
 33 a = 0
 46 a = 1

2.parallel statement groups

The fork-join keywords:

.group several statements together:

.cause the statements to evaluated in parallel(all at the same time)

*timing within parallel group is absolute to the begining of the group.

*block finishes after the last statement completes(statement with highest delay ,it can be the first statement in the block).

Example - Parallel

1 module parallel();
  2
  3 reg a;
  4
  5 initial
  6 fork
  7   $monitor ("%g a = %b", $time, a);
  8    #10 a = 0;
  9    #11 a = 1;
10    #12 a = 0;
11    #13 a = 1;
12    #14 $finish;
13 join
14
15 endmodule

Simulator Output

0 a = x
10 a = 0
11 a = 1
12 a = 0
13 a = 1

Example - Mixing "begin-end" and "fork - join"

1 module fork_join();
  2
  3 reg clk,reset,enable,data;
  4
  5 initial  begin
  6   $display ("Starting simulation");
  7   $monitor("%g clk=%b reset=%b enable=%b data=%b",
  8     $time, clk, reset, enable, data);
  9   fork : FORK_VAL
10      #1 clk = 0;
11      #5 reset = 0;
12      #5 enable = 0;
13      #2 data = 0;
14   join
15    #10 $display ("%g Terminating simulation", $time);
16   $finish;
17 end
18
19 endmodule

Simulator Output

 0 clk=x reset=x enable=x data=x
 1 clk=0 reset=x enable=x data=x
 2 clk=0 reset=x enable=x data=0
 5 clk=0 reset=0 enable=0 data=0
 15 Terminating simulation
时间: 2024-08-07 00:00:59

verilog behavioral modeling--sequential and parallel statements的相关文章

verilog behavioral modeling ---Block statements

block statements : 1. sequential block  : begin-end block 2.parallel block       :  fork - join block block name : 如果block有自己的label, 1.可以disable 此block. 2.可以穿层次应用 block中的变量. 变量都是静态存储. PS:  when an assignement is to be made after two separate events h

verilog behavioral modeling --procedural assignments

1.procedural assignments are used for updating reg ,integer , time ,real,realtime and memory data types. 2.difference between procedural assignments and continuous assignments    (1)continuous assignments drive nets and are evaluated and updated when

verilog behavioral modeling--overview

1.verilog behavioral models contain procedural statements that control the simulation and manipulate variables of the data types.These statements are concurrent to model the inherent concurrence of hardware. 2.all of the flows defined by the initial

verilog behaviral modeling -- procedural timing contronls

1.delay control : an expression specifies the time duration between initially encountering the statement and when the statement actually executes. the delay expressiong can be dynamic function of the state of the circuit,but it can be a simple number

verilog behavioral modeling--procedural continous assignment(不用)

assign / deassgin force /release the procedural continuous assignments(using keywords assign and force) are procedural statements that allow expressions to be driven continously onto variables or nets. 1. net_lvalue = expression  in force statement n

Verilog之delay的两种用法(inter/intra)

verilog语言中有两种延迟方式:inter-delay和intra-delay,关于inter和intra.这两个英文前缀都有“内部,之间”的意思,但又有所不同.inter表达不同事物之间,intra表达同类事物之间,两者具体的含义请细细体会:).以阻塞式赋值为例(block assignment): 1.inter-delay的表达式为:  #delay-value a=b+c: 先说说阻塞式赋值语句执行的一般过程: block assignment方程的RHS先估值(evaluation

Samples for Parallel Programming with the .NET Framework

The .NET Framework 4 includes significant advancements for developers writing parallel and concurrent applications, including Parallel LINQ (PLINQ), the Task Parallel Library (TPL), new thread-safe collections, and a variety of new coordination and s

delta simulation time[(delta cycle), (delta delay)]

"Delta cycles are an HDL concept used to order events that occur in zero physical time."sigasi.com Taking the definition for Sigasi, what VHDL calls delay cycles, Verilog calls a scheduler. How VHDL and Verilog determine the order of zero time e

Github 的一个免费编程书籍列表

Index Ada Agda Alef Android APL Arduino ASP.NET MVC Assembly Language Non-X86 AutoHotkey Autotools Awk Bash Basic BETA C C# C++ Chapel Cilk Clojure COBOL CoffeeScript ColdFusion Cool Coq D Dart DB2 Delphi / Pascal DTrace Elasticsearch Emacs Erlang F#