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


沒有留言:

張貼留言

DISCORD ESP32

DISCORD  ESP32        準備工作:取得 Discord Webhook URL 開啟 Discord 並進入你的伺服器。 進入頻道設定(齒輪圖示) > 整合 (Integrations) > Webhook 。 點擊「建立 Webhook」,設定...