diff --git a/registers.py b/registers.py
index ad54b39e..ead20d4d 100755
--- a/registers.py
+++ b/registers.py
@@ -45,6 +45,8 @@ def __init__( self, name, short, description, address, sdesc, define ):
self.address = address
self.sdesc = sdesc
self.define = define
+ # Allow user to override our auto-generated register diagram.
+ self.diagram = None
self.fields = []
self.label = ( short or name ).lower() # TODO: replace spaces etc.
@@ -331,6 +333,9 @@ def parse_xml( path ):
define, values )
register.add_field( field )
+ for diagram in r.findall( 'diagram' ):
+ register.diagram = diagram.text.strip()
+
register.check()
registers.add_register( register )
return registers
@@ -935,6 +940,8 @@ def write_adoc( fd, registers ):
fd.write(remove_indent(r.description))
fd.write("\n")
+ if r.diagram:
+ fd.write(f"{remove_indent(r.diagram)}\n")
if r.fields:
if registers.prefix == "CSR_":
if int(r.address, 0) >= 0xc00:
diff --git a/xml/hwbp_registers.xml b/xml/hwbp_registers.xml
index 67b2b2da..0c66b994 100755
--- a/xml/hwbp_registers.xml
+++ b/xml/hwbp_registers.xml
@@ -43,6 +43,27 @@
If this trigger supports multiple types, then the hardware should
disable it by changing {tdata1-type} to 15.
+
+
+ [bytefield]
+ ----
+ (defattrs :plain [:plain {:font-family "M+ 1p Fallback"}])
+ (def row-height 45)
+ (def row-header-fn nil)
+ (def boxes-per-row 24)
+ (draw-column-headers {:labels ["XLEN-1" "" "" "" "XLEN-4" "" "XLEN-5" "" "XLEN-6" "" "" "" "" "" "" "" "0" "" "" "" "" "" "" ""]})
+ (draw-box "type" {:span 5})
+ (draw-box "dmode" {:span 3})
+ (draw-box "data" {:span 9})
+ (draw-box "" {:span 7 :borders {}})
+ (draw-box "4" {:span 5 :borders {}})
+ (draw-box "1" {:span 3 :borders {}})
+ (draw-box "XLEN - 5" {:span 9 :borders {}})
+ (draw-box "" {:span 7 :borders {}})
+ ----
+
+
There is no trigger at this {csr-tselect}.