-
Notifications
You must be signed in to change notification settings - Fork 5
pzbcm_gray
Taichi Ishitani edited this page Dec 26, 2022
·
3 revisions
https://github.com/pezy-computing/pzbcm/tree/master/pzbcm_gray
This interface implements encoder/decoder functions for Gray code.
name | type/width | default value |
---|---|---|
WIDTH | int | 4 |
- WIDTH
- Specify width of binary/Gray code value
This function encodes the given binary value to the Gray code value.
This function decode the given Gray code value to the binary value.
localparam int WIDTH = 8;
logic [WIDTH-1:0] input_value;
logic [WIDTH-1:0] gray_code_value;
logic [WIDTH-1:0] bianry_value;
pzbcm_gray #(WIDTH) u_gray();
always_comb begin
gray_code_value = u_gray.encode(input_value);
bianry_value = u_gray.decode(gray_code_value);
end