Various RDL Autogen fixes#579
Conversation
9252e79 to
e1a42cd
Compare
| end = offset + window["size"] - 4 | ||
| offset_string = f"{hex(offset)}-{hex(end)}" | ||
| end = offset + window["size"] - mem_width_bytes | ||
| offset_string = hex(offset) if num_entries == 1 else f"{hex(offset)}-{hex(end)}" |
There was a problem hiding this comment.
Nit:
| offset_string = hex(offset) if num_entries == 1 else f"{hex(offset)}-{hex(end)}" | |
| offset_string = hex(offset) if num_entries == 1 else f"{offset:x}-{end:x}" |
There was a problem hiding this comment.
Didn't know about this feature, looks much less noisy
There was a problem hiding this comment.
Very useful format specifiers, it's my hex and bin calculator 😄
python -c "print(f'{0x20+0b11:x}')"
python -c "print(f'{0x20+0b11:b}')"| typed_registers, key=lambda reg: min(reg[0]["offsets"]) | ||
| # all the struct declaration fields. Tag each with a boolean value representing whether | ||
| # it is a register or not (a window). | ||
| declaration_fields = [(True, register) for register in typed_registers] + [ |
There was a problem hiding this comment.
The tuple isn't great for readability. The json file has a field "type" can be used instead of the tuple. Or you could simply check if the offset field is an array
There was a problem hiding this comment.
I mentioned this on previous PR(s) but these would really benefit from being a bit more object-oriented with either dataclasses or Pydantic models, it would help to solve this readability a bit. Albeit that's obviously a larger refactoring task.
For now, if nothing else is workable, this might be more readable as its own dict e.g.: {"is_window": False, "field": register}, even if a bit less efficient.
AlexJones0
left a comment
There was a problem hiding this comment.
I've not checked the RDL, only the SW changes.
| typed_registers, key=lambda reg: min(reg[0]["offsets"]) | ||
| # all the struct declaration fields. Tag each with a boolean value representing whether | ||
| # it is a register or not (a window). | ||
| declaration_fields = [(True, register) for register in typed_registers] + [ |
There was a problem hiding this comment.
I mentioned this on previous PR(s) but these would really benefit from being a bit more object-oriented with either dataclasses or Pydantic models, it would help to solve this readability a bit. Albeit that's obviously a larger refactoring task.
For now, if nothing else is workable, this might be more readable as its own dict e.g.: {"is_window": False, "field": register}, even if a bit less efficient.
Add a none variant with a value of 0 when generating flag enum bits. This is useful to represent "no interrupt(s)" or "no bits" to give to an enable_write/status_write function. Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
The SPI Host has two register windows in between other register fields, whereas before this it was assumed that all register windows come after registers. Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
This includes the auto-generated ethernet driver header.
e1a42cd to
6c707d0
Compare
Signed-off-by: Alice Ziuziakowska <a.ziuziakowska@lowrisc.org>
enable_writeorstatus_writeto clear the register, needed by Update SPI Device HAL to use new autogen interface #387.This also adds the autogenerated SPI Host and Ethernet headers.
Closes #522.