reading a bookRegister


One of the two Verilog data classes. Registers are used to store values in behavioural models.

Syntax ( Key to Notation )

{either}
reg [Range] RegisterOrMemory, ...;
integer RegisterOrMemory, ...;
time RegisterOrMemory, ...;
real RegisterName, ...;
realtime RegisterName, ...;

RegisterOrMemory = {either}
RegisterName
MemoryName [ConstantExpression:ConstantExpression]

Range = [ConstantExpression:ConstantExpression]

Where

See Declaration.

Rules

Gotchas!

Synthesis

Tips

Use reg for describing logic, integer for loop variables and calculations, real in system models, and time and reatime for storing simulation times in test fixtures.

Example

reg a, b, c;
reg [7:0] mem[1:1024], byte;
real r;

The following fragment shows how the regs and integers are commonly used.

integer i;
reg [15:0] V;
reg Parity;

always @(V)
begin
  for ( i = 0; i <= 15; i = i + 1 )
  begin
    Parity = Parity ^ V[i];
  end
end

See Also

Net


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