我对verilog很新,我刚开始明白它是如何工作的。
我想操纵一个模块[HttpPost]
public ActionResult MyAction(FormVM model)
{
if (!(model.Property1 || model.Property2 || model.Property3))
{
ModelState.AddModelError(nameof(model.Property1), "You must select at least one");
}
if (ModelState.IsValid)
{
// Do something
}
return View(model);
}
的输入,总是阻塞,但我不知道该怎么做。
mant[22:0]
所以如果bit22为零,我必须移位module normalize(mant,exp,mant_norm,exp_norm);
input [22:0]mant;
input [7:0]exp;
output [22:0]mant_norm;
output [7:0]exp_norm;
reg mantreg[22:0];
reg count=0;
always@(mant or exp)
begin
mantreg<=mant; //this gives an error
if(mant[22]==0)
begin
mant<={mant[21:0],1'b0};//this also gives an error
count<=count+1;
end
end
endmodule
寄存器并计算移位次数。我很困惑何时使用reg以及何时使用wire以及如何进行操作。请帮助让我知道如何去做。
答案 0 :(得分:1)
正如您在代码中看到的那样,您将向量值(mant)分配给23(mantreg)数组。相反,你应该将mantreg声明为reg [22:0] mantreg(它是23位的向量)。
无法在程序上分配导线类型变量。它们仅用于继续分配。 reg varible的其他方式只能是程序分配。
为此尝试读出Verilog的LRM。