用verilog HDL语法编写

请设计一个50进制的减法计数器(从50计到00),每1 秒减一次,用两个数码管显示计数结果,给出程序设计、软件编译、仿真分析、硬件测试及详细实验过程

参考:

module counter50(input clk, input reset, output reg [7:0] count_out);
  reg [4:0] count;
  reg enable;
  
  always @(posedge clk) begin
    if (reset) begin
      count <= 5'b50;
      enable <= 1'b1;
    end else if (enable) begin
      count <= count - 1;
      if (count == 5'b00000) begin
        enable <= 1'b0;
      end
    end
  end
  
  // 计数器输出
  always @* begin
    // 将计数器值转换为 50 进制字符串
    case (count)
      5'b50: count_out <= 8'b00110010;
      5'b49: count_out <= 8'b00110001;
      5'b00: count_out <= 8'b00110000;
    endcase
  end
endmodule

50进制???

Verilog HDL】24进制计数器
可以借鉴下,挺详细的
https://blog.csdn.net/qq_44431690/article/details/111460776


基于用Verilog HDL设计十进制减法计数器,可参考进行编写24进制减法计数器
module CNT10 (CLK, RST, EN, CQ, COUT);
input CLK,RST,EN;
output[3:0] CQ;
output COUT;
reg[3:0] CQ,CQI;
reg COUT;
always @(posedge CLK)//检测时钟上升沿
begin : u1
if (RST == 1'b1)//计数器复位
begin
CQI={4{1'b0}};
end
begin
if(EN==1'b1)//检测是否允许计数
begin
if (CQI<9)
begin
CQI=CQI+1; //允许计数
end
else
begin
CQI={4{1'b0}}; //大于9,计数值清零
end
end
end
if (CQI==9)
begin
COUT<=1'b1 ; //计数大于9,输出进位信号
end
else
begin
COUT<=1'b0 ;
end
CQ<=CQI ; //将计数值向端口输出
end
endmodule