Skip to content

Commit b199a0f

Browse files
committed
Style guide updates. closes #51
1 parent 156f779 commit b199a0f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/style-guide.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ There is no need to yell.
199199
200200
MY_FIELD INST;
201201
202+
.. note::
203+
If you are transcribing a datasheet or other source material into SystemRDL,
204+
and that uses upper-case for register/field names, use the original case unchanged.
202205

203206

204207
Parameters and Verilog-style macros are uppercase
@@ -228,3 +231,42 @@ Start and end quotation marks use the same rules as braces.
228231
It requires multiple lines that are all indented at the same level.
229232
";
230233
} my_field_b;
234+
235+
236+
Avoid unnecessary prefixes in names
237+
-----------------------------------
238+
239+
SystemRDL is a hierarchical language. There is no need to prefix registers with
240+
the device name, or fields with the register name. Each hierarchy is a distinct
241+
instance scope, so no need to worry about name collisions.
242+
243+
|:thumbsdown:| No:
244+
245+
.. code:: systemrdl
246+
247+
addrmap spi_controller {
248+
reg {
249+
default sw = rw;
250+
default hw = r;
251+
252+
field {} spi_ctrl_enable;
253+
field {} spi_ctrl_reset;
254+
field {} spi_ctrl_mode;
255+
} spi_ctrl;
256+
};
257+
258+
259+
|:thumbsup:| Yes:
260+
261+
.. code:: systemrdl
262+
263+
addrmap spi_controller {
264+
reg {
265+
default sw = rw;
266+
default hw = r;
267+
268+
field {} enable;
269+
field {} reset;
270+
field {} mode;
271+
} ctrl;
272+
};

0 commit comments

Comments
 (0)