File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,34 @@ parameterizations.
242242 my_reg_type #(.SIZE(16), .RESET(16'hABCD)) r3;
243243
244244
245+ Enumerated Fields
246+ -----------------
247+ In most cases, a field will represent a numeric value in your design. However,
248+ sometimes it is useful to ascribe names to enumerated values using an RDL ``enum ``.
249+ An enumeration can be bound to a field using the ``encode `` property.
250+
251+ .. code-block :: systemrdl
252+
253+ // An enum associatyes names with values
254+ enum system_state_e {
255+ IDLE = 0 {
256+ desc = "The system is idle and ready for input";
257+ };
258+
259+ BUSY = 1 {
260+ desc = "Busy processing an input";
261+ };
262+
263+ SLEEP = 2; // No properties assigned
264+ SHUTDOWN; // Infers value of 3
265+ };
266+
267+ field {
268+ encode = system_state_e;
269+ reset = system_state_e::IDLE;
270+ } system_state[1:0];
271+
272+
245273 Some Examples
246274-------------
247275Here are a few interesting examples of what you can do with SystemRDL.
You can’t perform that action at this time.
0 commit comments