Minres / CoreDSL

Xtext project to parse CoreDSL files
Apache License 2.0
16 stars 3 forks source link

Attribute [[expected_encoding_width]] #68

Closed AtomCrafty closed 1 year ago

AtomCrafty commented 2 years ago

I would like to suggest an [[expected_encoding_width=32]] attribute that can be applied to the instructions block of an ISA or individual instructions and will cause the frontend to report a warning/error if an instruction's encoding has a differing width.

The reason is that - with so many bit ranges and verilog literals - it is very easy to slip up and be off by one bit here and there. Especially because you need to keep in mind that the bit ranges are inclusive on both ends, so their length is end - start + 1.

Here is an example.

eyck commented 2 years ago

Good idea as it allows to catch errors early.

jopperm commented 2 years ago

Yup great idea, and a good companion to the new [[format=...]] attribute. Will add it to the spec.

jopperm commented 1 year ago

Proactively added to spec: Diff

(TBD if this feature makes it into 2.0 or is pushed)

AtomCrafty commented 1 year ago

Remind me again, did we decide to include the frontend checks for this in 2.0? Syntax is already supported.

eyck commented 1 year ago

If I remember correctly the decision was no checking in the frontend. As it is an 'expected' setting violations should not be an error ;-)

jopperm commented 1 year ago

Ok great, closing this then.