Verilog:检查,是否有100个信号处于活动状态?

Verilog:检查,是否有100个信号处于活动状态?,verilog,hdl,Verilog,Hdl,我有一个输入和一个输出。如果输入是100个活动周期(100个周期),我想把输出变成1 模块检查\u 100( 输入线时钟, 输入线复位, _a中的输入线, 输出reg out_a); reg[10:0]计数器; 始终@(posedge时钟)开始 计数器一种方法是在count==100时使用连续赋值来设置输出。当输入变低时,计数器复位。当计数值达到100时保持不变 module check_100( input wire clock, input wire reset, inpu

我有一个输入和一个输出。如果输入是100个活动周期(100个周期),我想把输出变成1

模块检查\u 100(
输入线时钟,
输入线复位,
_a中的输入线,
输出reg out_a);
reg[10:0]计数器;
始终@(posedge时钟)开始

计数器一种方法是在count==100时使用连续赋值来设置输出。当输入变低时,计数器复位。当计数值达到100时保持不变

module check_100(
   input wire clock,
   input wire reset,
   input wire in_a,
   output wire out_a
);  

reg [10:0] counter;  

assign out_a = counter == 100;

always @(posedge clock) begin
    if (reset) begin
        counter <= 0;
    end else if (!in_a) begin
        counter <= 0;
    end else if (counter < 100) begin
        counter <= counter + 1;
    end
end

endmodule
模块检查\u 100(
输入线时钟,
输入线复位,
_a中的输入线,
输出线out_a
);  
reg[10:0]计数器;
分配出=计数器==100;
始终@(posedge时钟)开始
如果(重置)开始
柜台
module check_100(
   input wire clock,
   input wire reset,
   input wire in_a,
   output wire out_a
);  

reg [10:0] counter;  

assign out_a = counter == 100;

always @(posedge clock) begin
    if (reset) begin
        counter <= 0;
    end else if (!in_a) begin
        counter <= 0;
    end else if (counter < 100) begin
        counter <= counter + 1;
    end
end

endmodule