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.

[Moved] variable data type verilog HDL

Status
Not open for further replies.

preethi19

Full Member level 5
Joined
Jun 30, 2014
Messages
273
Helped
0
Reputation
0
Reaction score
1
Trophy points
16
Activity points
3,474
it is put that variable data types can be assigned only inside a procedure, task or function. check the following verilog code

Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module mult_acc 
(
input [7:0] ina,inb;
input clk, aclr;
ouput [15:0] out;
)
wire [15:0] mult_out, adder_out;
reg [15:0] out;
 
assign adder_out=mult_out+out;
always @ (posedge clk or posedge aclr)
                if (aclr) out=16'h0000;
                else out=adder_out;
 
multa u1(.in_a(ina), .in_b(inb), .m_out(mult_out));
 
endmodule




just took this example from the net. I'm just starting with the basics so i don't know much abt the entire code but my doubt here is reg is a variable data type right and it should be within a procedure which in this case should be inside always block but why is it not der. can someone pls explain me why reg is used outside and if we can use variable data types outside in wat cases do we use it (i mean to describe wat)
 
Last edited by a moderator:

it is put that variable data types can be assigned only inside a procedure, task or function

With above statement i conclude that you have confusion about vhdl and verilog.First of all there are no procedures in verilog only procedural blocks initial,always blocks (vhdl has procedures).Similarly in vhdl there are no tasks (vhdl has functions and procedures)..for verilog you can not declare variables inside procedural blocks ,initial and always.You can declare them inside functions and tasks.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top