2021年4月22日 星期四

HBLbits_Verilog Basic_Popcount255

HBLbits_Verilog Basic_Popcount255 

A "population count" circuit counts the number of '1's in an input vector. Build a population count circuit for a 255-bit input vector.


module top_module( 
    input [254:0] in,
    output [7:0] out );
    integer i;
    always@(*)begin
        out = 0;
        for(i=0;i<=254;i=i+1)begin
            if (in[i])
                out=out+1;
        end
    end
endmodule


沒有留言:

張貼留言

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red 1) 安裝Node-Red  https://ithelp.ithome.com.tw/articles/10201795 https://www.youtube.com/watch?v...