Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compact form for bit vector literals #16

Open
drom opened this issue May 2, 2020 · 1 comment
Open

compact form for bit vector literals #16

drom opened this issue May 2, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@drom
Copy link
Member

drom commented May 2, 2020

Verilog allows bit vectors or arbitrary width. Example wire [26:0] state
VCD dump state changes like b101010101010101010101010101
We need a compact binary form of storing such constants.

LEB128 option

MSB --------------------------- LSB
        101010101010101010101010101 27-bit raw binary
       0101010101010101010101010101 Padded to a multiple of 7 bits
 0101010  1010101  0101010  1010101 Split into 7-bit groups
00101010 11010101 10101010 11010101 Add high 1 bits on all but last (most significant) group to form bytes
    0x2A     0xD5     0xAA     0xD5 In hexadecimal
-> D5 AA D5 2A                      Output stream (LSB to MSB)

Verilog / VCD also allows 4-state values like: b10101zzzz01010101xxxx010101

That can be represented as mask value:

       0 1 x z
value: 0 1 0 1
mask:  0 0 1 1

Mask also can be LEB128 encoded.
In the case of a 2-state vector, mask will occupy 1 byte.

@drom drom added the enhancement New feature or request label May 2, 2020
@drom
Copy link
Member Author

drom commented Sep 13, 2020

maybe base64? https://en.wikipedia.org/wiki/Base64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant