Popcount255

2023. 6. 20. 00:45FPGA/HDLBits

728x90

Problem Statement

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<255;i++) begin
            out = out + in[i];
        end
    end
endmodule

 

'FPGA > HDLBits' 카테고리의 다른 글

Tb/tb1  (0) 2023.06.20
Tb/clock  (0) 2023.06.20
Vector100r  (0) 2023.06.20
Gates100  (0) 2023.06.20
Bugs case  (0) 2023.06.20