天风 发表于 2020-4-2 15:55:30

关于加一个使能,但计数时间过长,结果显示要等待,怎么改

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
但结果显示不对,怎么改
页: [1]
查看完整版本: 关于加一个使能,但计数时间过长,结果显示要等待,怎么改