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

Simplifyinf bin2gray interface

- Using gray/bin as inputs was cute, but not useful when actually instantiating and reading the code. in/out works better.
This commit is contained in:
Andreas Olofsson 2016-04-13 20:46:02 -04:00
parent 3ccd72016e
commit 0432f22c67
2 changed files with 17 additions and 7 deletions

View File

@ -8,12 +8,17 @@
module oh_bin2gray #(parameter DW = 32 // width of data inputs
)
(
input [DW-1:0] bin, //binary encoded input
output [DW-1:0] gray //gray encoded output
input [DW-1:0] in, //binary encoded input
output [DW-1:0] out //gray encoded output
);
reg [DW-1:0] gray;
reg [DW-1:0] gray;
wire [DW-1:0] bin;
integer i;
assign bin[DW-1:0] = in[DW-1:0];
assign out[DW-1:0] = gray[DW-1:0];
always @*
begin

View File

@ -7,13 +7,18 @@
module oh_gray2bin #(parameter DW = 32) // width of data inputs
(
input [DW-1:0] gray,//gray encoded input
output [DW-1:0] bin //binary encoded output
input [DW-1:0] in, //gray encoded input
output [DW-1:0] out //binary encoded output
);
reg [DW-1:0] bin;
reg [DW-1:0] bin;
wire [DW-1:0] gray;
integer i,j;
assign gray[DW-1:0] = in[DW-1:0];
assign out[DW-1:0] = bin[DW-1:0];
always @*
begin
bin[DW-1] = gray[DW-1];
@ -24,7 +29,7 @@ module oh_gray2bin #(parameter DW = 32) // width of data inputs
bin[i] = bin[i] ^ gray [j];
end
end
endmodule // oh_gray2bin