reading a bookContinuous Assignment


Either a concurrent statement (continuous assignment) or a statement (procedural continuous assignment).

A continuous assignment creates events on one or more nets whenever nets or registers in the expression on the right hand side of the continuous assignment change value.

A procedural continuous assignment, when active, similarly assigns values to one or more registers, and prevents ordinary procedural assignments from affecting the values of the assigned registers.

Syntax ( Key to Notation )

{Continuous assignment:}

assign [Strength] [Delay] NetTarget = Expression ;

NetTarget = {either}
  NetName
  NetName[ConstantExpression]
  NetName[ConstantExpression:ConstantExpression]
  {NetTarget,...}
(See also Net)
{Procedural continuous assignment:}

assign RegisterTarget = Expression ;
deassign RegisterTarget ;

RegisterTarget = {either}
  RegisterName
  RegisterName[Expression]
  RegisterName[ConstantExpression:ConstantExpression]
  MemoryName[Expression]
  {RegisterTarget,...}

Where

module-<HERE>-endmodule {Continuous assignment}

See Statement for procedural continuous assignment.

Rules

Gotchas!

Continuous assignments are not the same as procedural continuous assignments, although they are similar. Make sure that you place an assign statement in the correct place: outside any initial or always statements for continuous assignments, and inside initial or always statements for procedural continuous assignments.

Synthesis

Tips

Example

wire cout, cin;
wire [31:0] sum, a, b;
assign {cout, sum} = a + b + cin;

wire enable;
wire [7:0] f;
reg [7:0] data;
assign #3 f = enable ? data : 8'bz;

always @(posedge Clock)
  Count = Count + 1;
always @(Reset)
  if (Reset)
    assign Count = 0;   // Prevents counting, until
                        // Reset goes low
  else
    deassign Count;

See Also

Net, Expression, Timing Control , Strength, Force


reference cardVerilog Quick Reference
teaching pointerDoulos Training Courses
reading a bookBack to the Verilog Golden Reference Guide


river sceneDoulos Home Page

Copyright 1995-1997 Doulos
This page was last updated 16th July 1996

mail iconWe welcome your e-mail comments. Please contact us at: webmaster@doulos.co.uk