betrusted-io / gateware

IP submodules, formatted for easier CI integration
Other
28 stars 5 forks source link

use fields for AES_CTRL.KEY_LEN #2

Closed xobs closed 4 years ago

xobs commented 4 years ago

The current implementation uses hardcoded values that generate sphinx warnings and render like this:

image

By using values, this gets rendered as a table:

image

Additionally, these values will eventually be able to be exported in the svd file, though that functionality does not yet exist.

This patch can be used to convert to using values:

diff --git a/betrusted-soc.py b/betrusted-soc.py
index 1223477..04e5c3a 100755
--- a/betrusted-soc.py
+++ b/betrusted-soc.py
@@ -751,7 +751,11 @@ class Aes(Module, AutoDoc, AutoCSR):

         self.ctrl = CSRStorage(fields=[
             CSRField("mode", size=1, description="set to `0' for AES_ENC, `1` for AES_DEC"),
-            CSRField("key_len", size=3, description="`AES128`=001, `AES192`=010, `AES256`=100"),
+            CSRField("key_len", size=3, description="length of the aes block", values=[
+                    ("001", "AES128"),
+                    ("010", "AES192"),
+                    ("100", "AES256"),
+            ]),
             CSRField("manual_start", size=1, description="If `0`, operation starts as soon as all data words are written"),
             CSRField("force_data_overwrite", size=1, description="If `0`, output is not updated until it is read"),             ])
bunnie commented 4 years ago

I think you have push rights, you can go ahead and just fix bugs like this...i'll see the commit message when it goes through.

xobs commented 4 years ago

Sounds good.

(Also, this issue should have gone into "soc". Oops.)