alexmihai
Newbie level 1
Hello,
I need to do a design that sorts the bits of a 32-bit vector(not sure if it's called vector) like this:
I must have a 32-bit parallel in and a serial out.
And it must be combinational.
I tried something like this:
But I tought I would need to do the design sequential if I count the ones.
Can you please help me do this? My head hurts from trying to understand verilog.
I need to do a design that sorts the bits of a 32-bit vector(not sure if it's called vector) like this:
Code:
1010010101010 => 00000001111111
And it must be combinational.
I tried something like this:
Code:
assign c=in[0]+in[1]+in[2]+in[3]+in[4]+in[5]+in[6]+in[7]+in[8]+in[9]+in[10]+in[11]+in[12]+in[13]+in[14]+in[15]+in[16]+in[17]+in[18]+in[19]+in[20]+in[21]+in[22]+in[23]+in[24]+in[25]+in[26]+in[27]+in[28]+in[29]+in[30]+in[31];
assign out=(1<<c)-1;
Can you please help me do this? My head hurts from trying to understand verilog.
Last edited by a moderator: