How to NOT use while() loops in verilog (for synthesis)?

后端 未结 3 698
一整个雨季
一整个雨季 2021-01-22 05:52

I\'ve gotten in the habit of developing a lot testbenches and use for() and while() loops for testing purpose. Thats fine. The problem is that I\'ve taken this habit over to cod

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-22 06:17

    You need to have a clock to control it to start.

    always @(posedge clk or negedge rst_n)
      if (!rst_n)
         num <= 32'b0; // or whatever your width is.
      else
         if (num < test_number)
           num <= num + 1'b1;
    

提交回复
热议问题