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

byte level #10

Closed
SadE54 opened this issue Nov 29, 2017 · 2 comments
Closed

byte level #10

SadE54 opened this issue Nov 29, 2017 · 2 comments
Labels

Comments

@SadE54
Copy link

SadE54 commented Nov 29, 2017

Hi,
Is it possible to represent a data structure at the byte level and not only bit level ? It could be a more generic protocol spec generator. I cannot find any tool on the web to do it like wavedrom . The closest tool is a latex macro :-/

@drom
Copy link
Member

drom commented Nov 29, 2017

@SadE54 you could definitely allocate byte wide fields inside the register like that.

[
  {bits: 8, name: 'byte0'},
  {bits: 8, name: 'byte1'},
  {bits: 8, name: 'byte2'},
  {bits: 8}
]

Are you looking for something different?

@drom drom added the question label Nov 29, 2017
@K4zuki
Copy link
Contributor

K4zuki commented Nov 29, 2017

Hello @SadE54 ,

guess something like this one? http://blockdiag.com/en/nwdiag/index.html

my another guess is setting lanes and bits at same value.

from README:

--input      : input JSON filename - must be specified always
--vspace     : vertical space - default 80
--hspace     : horizontal space - default 640
--lanes      : rectangle lanes - default 2
--bits       : overall bitwidth - default 32
--bigendian  : - default false
--fontfamily : - default sans-serif
--fontweight : - default normal
--fontsize   : - default 14

make a file four-byte.json like following:

[
  {"bits": 1, "name": "byte0"},
  {"bits": 1, "name": "byte1"},
  {"bits": 1, "name": "byte2"},
  {"bits": 1}
]

then try: bitfield --input four-byte.json --lane 4 --bits 4 > four-byte.svg

results:

<svg xmlns="http://www.w3.org/2000/svg" width="649" height="165" viewBox="0 0 649 165">
  <g transform="translate(4.5,80.5)">
    <g stroke="black" stroke-width="1" stroke-linecap="round" transform="translate(0,20)">
      <line x2="640"/>
      <line y2="40"/>
      <line x2="640" y1="40" y2="40"/>
      <line x1="640" x2="640" y2="40"/>
      <line x1="320" x2="320" y2="40"/>
    </g>
    <g text-anchor="middle">
      <g>
        <g transform="translate(0,20)"/>
        <g transform="translate(160,16)">
          <text x="320" font-size="14" font-family="sans-serif" font-weight="normal">0</text>
          <text x="0" font-size="14" font-family="sans-serif" font-weight="normal">1</text>
        </g>
        <g transform="translate(160,44)">
          <text x="320" font-size="14" font-family="sans-serif" font-weight="normal">
            <tspan>byte0</tspan>
          </text>
          <text x="0" font-size="14" font-family="sans-serif" font-weight="normal">
            <tspan>byte1</tspan>
          </text>
        </g>
        <g transform="translate(160,80)"/>
      </g>
    </g>
  </g>
  <g transform="translate(4.5,0.5)">
    <g stroke="black" stroke-width="1" stroke-linecap="round" transform="translate(0,20)">
      <line x2="640"/>
      <line y2="40"/>
      <line x2="640" y1="40" y2="40"/>
      <line x1="640" x2="640" y2="40"/>
      <line x1="320" x2="320" y2="40"/>
    </g>
    <g text-anchor="middle">
      <g>
        <g transform="translate(0,20)">
          <rect style="fill-opacity:0.1" x="0" y="0" width="320" height="40"/>
        </g>
        <g transform="translate(160,16)">
          <text x="320" font-size="14" font-family="sans-serif" font-weight="normal">2</text>
          <text x="0" font-size="14" font-family="sans-serif" font-weight="normal">3</text>
        </g>
        <g transform="translate(160,44)">
          <text x="320" font-size="14" font-family="sans-serif" font-weight="normal">
            <tspan>byte2</tspan>
          </text>
        </g>
        <g transform="translate(160,80)"/>
      </g>
    </g>
  </g>
</svg>

the result is 2-bit 2-lane but these may be minimums

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

No branches or pull requests

3 participants