Dataflow modeling is a higher level of abstraction. The designer no need have any knowledge of logic circuit. He should be aware of data flow of the design. The gate level modeling becomes very complex for a VLSI circuit. Hence dataflow modeling became a very important way of implementing the design.
In dataflow modeling most of the design is implemented using continuous assignments, which are used to drive a value onto a net. The continuous assignments are made using the keyword assign.
The assign statement
The assign statement is used to make continuous assignment in the dataflow modeling. The assign statement usage is given below:
assign out = vs0 + vs1; // vs0 + vs1 is evaluated and then assigned to out.
- The LHS of assign statement must always be a scalar or vector net or a concatenation. It cannot be a register.
- Continuous statements are always active statements.
- Registers or nets or function calls can come in the RHS of the assignment.
- The RHS expression is evaluated whenever one of its operands changes. Then the result is assigned to the LHS.
- Delays can be specified.
Examples:
assign vs[3:0] = vs0[3:0] & vs1[3:0];
assign {o3, o2, o1, o0} = vs0[3:0] | {vs1[2:0],vs2}; // Use of concatenation.
Implicit Net Declaration:
wire vs0, vs1;
assign out = vs0 ^ vs1;
In the above example out is undeclared, but verilog makes an implicit net declaration for out.
Implicit Continuous Assignment:
wire out = vs0 ^ vs1;
The above line is the implicit continuous assignment. It is same as,
wire out;
assign out = in0 ^ in1;
Delays
There are three types of delays associated with dataflow modeling. They are: Normal/regular assignment delay, implicit continuous assignment delay and net declaration delay.
Normal/regular assignment delay:
assign #10 out = in0 | in1;
If there is any change in the operands in the RHS, then RHS expression will be evaluated after 10 units of time. Lets say that at time t, if there is change in one of the operands in the above example, then the expression is calculated at t+10 units of time. The value of RHS operands present at time t+10 is used to evaluate the expression.
Implicit continuous assignment delay:
wire #10 out = vs0 ^ vs1;
is same as
wire out;
assign 10 out = vs0 ^ vs1;
Net declaration delay:
wire #10 out;
assign out = vs;
is same as
wire out;
assign #10 out = vs;