Code Conversion
The torii.lib.coding
module provides building blocks for conversion between different encodings of binary numbers.
One-hot coding
- class torii.lib.coding.Encoder(*args, src_loc_at: int = 0, **kwargs)
Encode one-hot to binary.
If one bit in
i
is asserted,n
is low ando
indicates the asserted bit. Otherwise,n
is high ando
is0
.
Priority coding
- torii.lib.coding.PriorityEncoder
alias of
Encoder
- torii.lib.coding.PriorityDecoder
alias of
Decoder
Gray coding
- torii.lib.coding.GrayEncoder
alias of
Encoder
- torii.lib.coding.GrayDecoder
alias of
Decoder