Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

need answer for verilog, why declare input as wire

Status
Not open for further replies.

oxford

Member level 2
Joined
Apr 30, 2004
Messages
47
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
312
verilog no declare wire

in verilog HDL design, why declare input signals as wire type?
Such as:
-----------------------
module ex1 (a,b,c);
input a;
input b;
output c;

wire a; // why declare 'a' as wire type
wire b; // why declare 'b' as wire type
reg c;
...
----------------------
is there some special reason?
 

There is no need to declare inputs as wire, by default they r wires, which acts as input signals to the logic which is going to be done inside the module
 

I can't understand why Verilog distinguish "wire" and "reg". In fact, "reg"s are not always registers. They should be declared as "reg"s just because they will be used in "always", but "always" doesn't mean registers.

Then what's the purpose of "reg" definition?
 

reg is used to store values whereas wire used to transfer values from one port to another.wire does not store the values as done by the reg.
 

Reg is storage element and wire is for passing info.
 

if reg variables are used in "always" without edge-controll sensitive list, then there is no storage elements.
 

eruisi said:
if reg variables are used in "always" without edge-controll sensitive list, then there is no storage elements.
No, even if your "always" without edge-controll sensitive list,your can still get a latch sometime.
 

You are right, but in general, this is not the right way we write the code.

When design a simple combinational circuit, you have two ways:
assign a = .... (wire)
always ... (reg)

but they are equivelant. No registers or latches are used.

beta0 said:
eruisi said:
if reg variables are used in "always" without edge-controll sensitive list, then there is no storage elements.
No, even if your "always" without edge-controll sensitive list,your can still get a latch sometime.
 

input just can be in RHS, so it/s wire
 

it is already wire
it is register when it is specified in particular to be so
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top