mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-17 20:02:53 +08:00
Name change one last time...
This commit is contained in:
parent
8b39f7e444
commit
97bc8d08af
@ -5,20 +5,18 @@
|
||||
//# License: MIT (see LICENSE file in OH! repository) #
|
||||
//#############################################################################
|
||||
|
||||
module oh_bin2onehot #(parameter DW = 32) // width of data inputs
|
||||
(
|
||||
input [NB-1:0] in, // unsigned binary input
|
||||
output [DW-1:0] out // one hot output vector
|
||||
);
|
||||
module oh_bin2onehot #(parameter N = 2 // output vector width
|
||||
)
|
||||
(
|
||||
input [NB-1:0] in, // unsigned binary input
|
||||
output [N-1:0] out // one hot output vector
|
||||
);
|
||||
|
||||
parameter NB = $clog2(DW); // encoded bit width
|
||||
|
||||
integer i;
|
||||
reg [DW-1:0] out;
|
||||
|
||||
always @*
|
||||
for(i=0;i<DW;i=i+1)
|
||||
out[i]=(in[NB-1:0]==i);
|
||||
localparam NB = $clog2(N); // binary encoded input
|
||||
|
||||
genvar i;
|
||||
for(i=0;i<N;i=i+1)
|
||||
assign out[i] = (in[NB-1:0] == i);
|
||||
|
||||
endmodule // oh_bin2onehot
|
||||
|
||||
@ -26,3 +24,5 @@ endmodule // oh_bin2onehot
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user