- always_ff @(posedge clk) begin
- if(input_btn == 4'b1110) cnt_full <= (CNT_BASE >> 3);
- if(input_btn == 4'b1101) cnt_full <= (CNT_BASE >> 4);
- if(input_btn == 4'b1011) cnt_full <= (CNT_BASE >> 5);
- if(input_btn == 4'b0111) cnt_full <= (CNT_BASE >> 6);
- end
-
- 加个使能
- always_comb begin
- led_state.state_next = led_state.state_current;
- case(led_state.state_current)
- RST, RUN: begin
- cnt_full <= CNT_BASE;
- if(input_btn == 4'b1110) led_state.state_next = BP0;
- if(input_btn == 4'b1101) led_state.state_next = BP1;
- if(input_btn == 4'b1011) led_state.state_next = BP2;
- if(input_btn == 4'b0111) led_state.state_next = BP3;
- end
- BP0: begin
- if(value_en) begin
- cnt_full <= CNT_BASE >> 3;
- led_state.state_next = RUN;
- end
- end
- 但结果显示不对,怎么改
复制代码
|