Popcount3
2023. 6. 12. 17:21ㆍFPGA/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 3-bit input vector.
module top_module(
input [2:0] in,
output [1:0] out );
always @(in)begin
out = 2'b00;
for(integer i = 0; i<3; i++)
begin
if(in[i] == 1'b1)
out = out + 1'b1;
end
end
endmodule
'FPGA > HDLBits' 카테고리의 다른 글
Mux2to1v (0) | 2023.06.12 |
---|---|
Mux2to1 (0) | 2023.06.12 |
Thermostat (0) | 2023.06.12 |
Ringer (0) | 2023.06.12 |
Combine circuits A and B (Mt2015 q4) (0) | 2023.06.12 |