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
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)
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: