[英]Verilog:Procedural Continuous Assignment to register is not supported
input [31:0] write_data;
input [4:0] write_reg;
reg [31:0] registers [31:0];
always @(*)
assign registers[write_reg] = write_data;
I have a 32-bit input write_data , which i want to an assign corresponding index which i get from write reg.Error says you cant do continuous assignment which i think causes by always@(*) but if i remove that 我有一个32位输入write_data,我想分配一个我从write reg。得到的索引。错误说你不能做我认为总是由always @(*)引起的连续分配,但是如果我删除了
It says object "registers" on left-hand side of assignment must have a net type and its another error. 它说分配左侧的对象“寄存器”必须具有网络类型,这是另一个错误。
assign
inside an always block is the procedural assignment
. assign
的总块里面的procedural assignment
。 It is not synthesizable and should not be used. 它是不可合成的,不应使用。 It is there for very special modeling cases.
它用于非常特殊的建模案例。
continuous assignment
, or assign
outside the always block is there for connecting nets
and used all over the places. continuous assignment
,或assign
外 always块是有连接nets
和各地使用的地方。 lhs of such an assignment must be a net type, ie wire . 这样的分配必须是网络类型,即wire 。 it cannot be a reg.
它不能是reg。
On the other hand all lhs in always blocks must be of 'reg' type. 另一方面, 始终块中的所有lh 都必须为“ reg”类型。
what you had to do in your case was to remove the keyword assign : 在这种情况下,您要做的就是删除关键字assign :
input [31:0] write_data;
input [4:0] write_reg;
reg [31:0] registers [31:0];
always @(*)
registers[write_reg] = write_data;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.