Difference between revisions of "Template:Regsimple2"

From WiiBrew
Jump to navigation Jump to search
(New page: {{#if:{{{1|}}}|<span id="{{anchorencode:{{{1|}}}}}"></span>}} {| style="border-collapse: collapse; padding: 0.2em 0.2em 0.2em 0.2em; text-align: center; border: 1px solid #bbb; width: 25em...)
 
m (fix width)
 
Line 5: Line 5:
 
|- style="text-align: center; background-color: #cdc;"
 
|- style="text-align: center; background-color: #cdc;"
 
! style="background-color: #ddd; width: 20%;" | &nbsp;
 
! style="background-color: #ddd; width: 20%;" | &nbsp;
| style="width: {{#expr: floor(80*{{{split|16}}}/{{{bits|32}}})}}%;" | <span style="display:block; float:left">{{#expr:{{{bits|32}}} - 1}}</span><span style="display:block; float:right">{{{split|16}}}</span>  
+
| <span style="display:block; float:left">{{#expr:{{{bits|32}}} - 1}}</span><span style="display:block; float:right">{{{split|16}}}</span>  
| <span style="display:block; float:left">{{#expr:{{{split|16}}} - 1}}</span><span style="display:block; float:right">0</span>  
+
| style="width: {{#expr: floor(80*{{{split|16}}}/{{{bits|32}}})}}%;" | <span style="display:block; float:left">{{#expr:{{{split|16}}} - 1}}</span><span style="display:block; float:right">0</span>  
 
|- style="text-align: center; background-color: #eee;"
 
|- style="text-align: center; background-color: #eee;"
 
| style="background-color: #ddd;" | Access
 
| style="background-color: #ddd;" | Access

Latest revision as of 17:44, 27 February 2009

REG_FOO (0xADDRESS)
  3116 150
Access U {{{access}}}


[edit] Template documentation

This template can be used for simple registers with two fields, especially where the first field is just Unimplemented bits (i.e. registers where the top bits are unused).

Usage

{{regsimple2 | MAGIC_REGISTER | addr=0x1337 | bits=32 | split=24 | access = W}}

Gives:

MAGIC_REGISTER (0x1337)
  3124 230
Access U W


The width is adjusted automagically:

{{regsimple2 | MAGIC_REGISTER | addr=0x1337 | bits=32 | split=8 | access = W}}

MAGIC_REGISTER (0x1337)
  318 70
Access U W


See also