D
Daku
Guest
Could some Verilog guru please help ? I came upon the following code
snippet:
function [6:0] bin2ther;
input [2:0] bin;
begin
case (bin)
3'h0: bin2ther = 7'b0000000;
3'h1: bin2ther = 7'b0000001;
3'h2: bin2ther = 7'b0000011;
3'h3: bin2ther = 7'b0000111;
3'h4: bin2ther = 7'b0001111;
3'h5: bin2ther = 7'b0011111;
3'h6: bin2ther = 7'b0111111;
3'h7: bin2ther = 7'b1111111;
endcase
end
endfunction
What I find confusing is :
Both 'bin' and 'bin2ther' are little-endian, so that
the left-most bit is LSB and rightmost bit MSB - so not the values for
bin2ther be reversed, for example :
3'h1 : bin2ther = 7'b1000000;
Am I confusing something. thanks in advance for your help.
snippet:
function [6:0] bin2ther;
input [2:0] bin;
begin
case (bin)
3'h0: bin2ther = 7'b0000000;
3'h1: bin2ther = 7'b0000001;
3'h2: bin2ther = 7'b0000011;
3'h3: bin2ther = 7'b0000111;
3'h4: bin2ther = 7'b0001111;
3'h5: bin2ther = 7'b0011111;
3'h6: bin2ther = 7'b0111111;
3'h7: bin2ther = 7'b1111111;
endcase
end
endfunction
What I find confusing is :
Both 'bin' and 'bin2ther' are little-endian, so that
the left-most bit is LSB and rightmost bit MSB - so not the values for
bin2ther be reversed, for example :
3'h1 : bin2ther = 7'b1000000;
Am I confusing something. thanks in advance for your help.