1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00

Name change one last time...

This commit is contained in:
Andreas.Olofsson 2020-04-07 10:25:54 -04:00
parent 8b39f7e444
commit 97bc8d08af

View File

@ -5,20 +5,18 @@
//# License: MIT (see LICENSE file in OH! repository) # //# License: MIT (see LICENSE file in OH! repository) #
//############################################################################# //#############################################################################
module oh_bin2onehot #(parameter DW = 32) // width of data inputs module oh_bin2onehot #(parameter N = 2 // output vector width
( )
(
input [NB-1:0] in, // unsigned binary input input [NB-1:0] in, // unsigned binary input
output [DW-1:0] out // one hot output vector output [N-1:0] out // one hot output vector
); );
parameter NB = $clog2(DW); // encoded bit width localparam NB = $clog2(N); // binary encoded input
integer i; genvar i;
reg [DW-1:0] out; for(i=0;i<N;i=i+1)
assign out[i] = (in[NB-1:0] == i);
always @*
for(i=0;i<DW;i=i+1)
out[i]=(in[NB-1:0]==i);
endmodule // oh_bin2onehot endmodule // oh_bin2onehot
@ -26,3 +24,5 @@ endmodule // oh_bin2onehot