1. always(posedge CLOCK) 2. case(i) 3. 4. 0: 5. if(C1 == 8) begin C1 <= 4’d0; i <= i + 1’b1; end 6. else begin reg1 <= reg1 + 1’b1; C1 <= C1 + 1’b1; end 7. 8. endcase 9. 10. always(posedge CLOCK) 11. case(i) 12. 13. 0,1,2,3,4,5,6,7: 14. begin 15. reg1 <= reg1 + 1’b1; 16. if( C1 == 8 -1 ) begin C1 <= 4’d0; i <= i + 1’b1; end 17. else C1 <= C1 + 1’b1; 18. end 19. 20. endcase
2. for循环
for(i = 0; i < N; i = i + 1)
时间: 2024-10-23 16:43:43