【问题标题】:Syntax error occurs when calling a module in vivadovivado中调用模块时出现语法错误
【发布时间】:2019-12-06 14:07:50
【问题描述】:

在 xilinx vivado 中实现以下代码时,调用子模块时出现语法错误

FA5,FD2,fc2,com1,com2,com3  

除了模块 FA4、FD1 和 fc1。

所有子模块都经过测试并且工作正常。如何调整 MAU 模块以正确调用给定模块?

module MAU(clk,reset,Nmax,error_tol,omega,error,result);

input clk,reset;
input Nmax,error_tol,omega;
output error,result;

wire[15:0] Nmax,error_tol,omega,result;
reg[15:0] a,b,aplusb,c,zero,n;
wire[15:0] fc1,fc2,fc_out;
wire FA4,FA5,FD1,FD2,com1,com2,com3;
reg [15:0] bigNum1,bigNum2,bigNum3;
integer error;

always@*
begin
a<=16'b0000000000000000;   //initial value of a
b<=16'b0111110000000000;   //initial value of b
n<=16'b0111110000000000;   //initial value of n
zero<=16'b0000000000000000;//loading the value of zero
end

begin                    //finding the initial C and fc_out
float_adder FA4(.num1(a),.num2(b),.result(aplusb));   //finding initial a+b
float_divider FD1(.num(aplusb),.result(c));           //finding initial c
fc_value fc1(.omega(omega),.x(c),.fc_out(fc_out));    //find  iniitial fc_out
end


always@*
begin
while ((bigNum1[15:0]==fc_out[15:0]) |(bigNum2[15:0]==Nmax[15:0]))  //consider two conditions

n <= n + 1'b1;

comparator com3(.num1(fc_out),.num2(zero),.bigNum(bigNum3));          //compare and output big value from fc_out and zero 

if(fc_out[15:0]==bigNum3[15:0])//considering the condition

  begin
  assign a=c;
  end

else
 begin
 assign b=c;
 end


  begin                    //updating C and fc_out
  float_adder FA5(.num1(a),.num2(b),.result(aplusb));   //updating a+b
  float_divider FD2(.num(aplusb),.result(c));           //updating c
  fc_value fc2(.omega(omega),.x(c),.fc_out(fc_out));    //updating fc_out


 comparator com1(.num1(fc_out),.num2(error_tol),.bigNum(bigNum1)); //compare and output big value from fc_out & error_tol
 comparator com2(.num1(Nmax),.num2(n),.bigNum(bigNum2));           //compare and output big value from Nmax and n
  end

end

 always@*
 if (bigNum1 != fc_out)

  begin
  assign error = 0 ;
  end

 else
  begin 
  assign error = 1 ;
  end


assign result = c;




endmodule

【问题讨论】:

    标签: syntax-error verilog vivado


    【解决方案1】:
    1. 我认为您应该在调用模块输出时使用电线,而不是寄存器;
    2. 在总是阻塞之外调用它;
    3. 不要在被调用模块的两个输出端口使用同一根线;
    4. 在always块的设计中使用clk;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      • 2010-11-26
      • 1970-01-01
      相关资源
      最近更新 更多