riscv / configuration-structure

RISC-V Configuration Structure
https://jira.riscv.org/browse/RVG-50
Creative Commons Attribution 4.0 International
36 stars 16 forks source link

Add custom support for fixed-width numbers. #24

Closed timsifive closed 3 years ago

timsifive commented 3 years ago

Supports any number of bits from 1 to 128. The user can use types by specifying Int1, Int2, Int3, all the way up to Int128.

To keep this efficient, I pulled the separate cs_decode.[ch] into the python tool, which now reads c_code.c and c_header.h and puts the contents into the files it generates.

Code size did go up a bit, from 1774/1856 to 1819/1873.

changab commented 3 years ago

The idea of this change is good. However the concerns of some tool-generated code for the firmware are,

I understand the implementation you have now is small and the code is generated on demand. In order to have a common CS decoder on the firmware solutions, the above should be considered. But I think don't have to do it right away, maybe just wait until we choose custom binary as the format of CS.

timsifive commented 3 years ago

It sounds like in the future we want two source options:

  1. Make the smallest possible parser for this schema.
  2. Make a parser that has code that can be useful to parse structures that are not part of this schema.

I think the overall code might be smaller if we generate 2 schema-specific parsers than if we have a single generic parser with shared code. We'll have to experiment with that, though.

Does that sound right? I must admit I'm still not entirely clear on the OEM use case you have in mind. Let's talk about that in email.