错题集:HDLBits Bcdadd100

错误答案:module top_module( input [399:0] a, b,input cin,output cout,output [399:0] sum );wire [99:0] co;genvar i

错误答案:

module top_module( 
    input [399:0] a, b,
    input cin,
    output cout,
    output [399:0] sum );
	
    wire [99:0] co;
    genvar i;    
    generate
        for(i=0;i<=99;i=i+1) begin: looper
            if(i==0)
                    bcd_fadd add0(a[3:0],b[3:0],cin,co[0],sum[3:0]);
            else
                bcd_fadd add0(a[4i+3:4i)],b[4i+3:4i],co[i-1],co[i],sum[4i+3:4i]);
        end
    endgenerate
    
    assign cout = co[99];
    
endmodule
Error (10170): Verilog HDL syntax error at top_module.v(14) near text: "i";  expecting "]". Check for and fix any syntax errors that appear immediately before or at the specified keyword. The Intel FPGA Knowledge Database contains many articles with specific details on how to resolve this error. Visit the Knowledge Database at https://www.altera/support/support-resources/knowledge-base/search.html and search for this specific error message number. File: /home/h/work/hdlbits.6672762/top_module.v Line: 14

正确答案:

module top_module( 
    input [399:0] a, b,
    input cin,
    output cout,
    output [399:0] sum );
	
    wire [99:0] co;
    genvar i;    
    generate
        for(i=0;i<=399;i=i+4) begin: looper
            if(i==0)
                    bcd_fadd add0(a[3:0],b[3:0],cin,co[0],sum[3:0]);
            else
                    bcd_fadd add0(a[i+3:i],b[i+3:i],co[(i>>2)-1],co[i>>2],sum[i+3:i]);
        end
    endgenerate
    
    assign cout = co[99];
    
endmodule

发布者:admin,转转请注明出处:http://www.yc00.com/web/1754578563a5177764.html

相关推荐

  • HDLBits

    2023-8-17
    200
  • 系统架构设计-错题集2025-3月

    系统架构设计-错题集2025-3月 软件确认测试效用树风险点、敏感点和权衡点RUP过程面向对象以及UMLUML四种事物 企业应用集成 (EAI)ABSD基于架构的软件开发方法DNS配置文件调度算法、RTOS、嵌入式相关调度算法嵌入式实时操作

    5月前
    250
  • PMP备考错题集-作业习题二

    1.由于缺乏资金&#xff0c;一个项目在启动阶段被终止&#xff0c;项目经理必须对项目收尾。项目经理首先应该做什么&#xff1f;Due to lack of funding, a project is ter

    1月前
    210
  • 错题集:HDLBits Bcdadd100

    错误答案&#xff1a;module top_module( input [399:0] a, b,input cin,output cout,output [399:0] sum );wire [99:0] co;genvar i

    1月前
    140

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信