rgen is a Python script for generating a hierarchical set of
register files and address decoders. It supports a variety of register
types and multiple levels of address decoding hieararchy.
tag name | attributes | description |
tv_registers | name,addr_sz,data_sz,base_addr,registered_read | top-level tag for a register file |
register | name,type,width,default | tag for a single logical register |
field | name,width,default | tag for a bit field within a single register |
register type | Access | description |
config | RW | General read-write configuration register |
status | RO | Read-only status register |
count | RW | Incrementing statistics register |
int_msk | Special | Interrupt status & mask registers |
soft_set | RW | Software set, hardware clear register |
write_stb | RW | Configuration register with additional strobe output |
read_stb | RW | Configuration register with additional strobe outout |
ext_load | RW | External-load register |
user | Special | User-defined pass-through register |
port name | direction | size | description |
NAME | output | WIDTH | Read-only value of config bits |
Basic configuration register, read/write by the configuration side, register bits available read-only from the hardware side.
port name | direction | size | description |
NAME | input | WIDTH | status input bits |
Status register, read-only by the config side, status bits are combinatorial input from the hardware side.
port name | direction | size | description |
NAME | output | WIDTH | current count value |
NAME_inc | input | 1 | When high, increment count by 1 |
Basic statistics register. Read/write by config side, count value
available read-only from hardware side. Increment value provided for
hardware side.
port name | direction | size | description |
NAME_set | input | WIDTH | set interrupt |
The int_msk register type provides a pair of interrupt registers.
The first register is the interrupt status register, and the second is
the interrupt mask register. The interrupt status register can be set
by hardware and cleared by software by writing a ‘1’ to the bit which
should be cleared. Software cannot set any bits in the interrupt
register, and writing ‘0’ to a bit has no effect (leave unchanged).
The paired mask register has the same number of bits as the status
register, but each bit set in the mask register disables interrupt
generation for the corresponding status bit. Note that even if
interrupt generation is disabled, the status bit will still be set. The
mask register is Read/Write by software.
The default attribute for this register type sets the default value
of the mask register; the default value of the status register is
always zero.
port name | direction | size | description |
NAME | output | WIDTH | Read-only value of config bits |
NAME_clr | input | WIDTH | Read-only value of config bits |
port name | direction | size | description |
NAME | output | WIDTH | Read-only value of config bits |
NAME_wr_stb | output | 1 | Pulses on write to this register |
port name | direction | size | description |
NAME | output | WIDTH | Read-only value of config bits |
NAME_wr_stb | output | 1 | Pulses on read to this register |
port name | direction | size | description |
NAME_out | output | WIDTH | Data from config interface |
NAME_in | input | WIDTH | Sample data in to config interface |
NAME_wr_stb | output | 1 | Pulsed on final write operation |
NAME_rd_stb | output | 1 | Pulsed on initial read operation |
An external-load register is used to sample and cache values which
may be changing over time. It is intended to be used for values which
are wider than the configuration interface (otherwise, a status or write_stb
register would be more appropriate). The width of an ext_load register
can be wider than the data_sz width of the module, and rgen will split
the logical register into multiple physical registers.
Current limitations: ext_load registers must be an even multiple of data_size otherwise syntax errors will result.
port name | direction | size | description |
NAME_wr_data | output | WIDTH | Data from config on write |
NAME_wr_stb | output | 1 | Asserted during write operation |
NAME_wr_ack | input | 1 | Assert by HW side to acknowledge write |
NAME_rd_data | input | WIDTH | Data to config on read |
NAME_rd_stb | output | 1 | Asserted during read operation |
NAME_rd_ack | input | 1 | Assert by HW side to acknowledge read |
Register with user-defined behavior. Used to implement registers
with read-side effects, or where config interface must arbitrate with
the HW datapath for access to a resource. Provides full handshake for
each of read and write operations.
Decoders are created using a different set of tags from the register file generator.
tag name | attributes | description |
it_decoder | name,addr_sz,data_sz | top-level tag for an address decoder |
range | prefix,base,bits | tag for an address decode range |