prga.app.softregs module

class prga.app.softregs.SoftReg(name, type_, addr, width, bytewidth, rstval)

Bases: prga.util.Object

Soft register definition.

Parameters:
  • name (str) – Name of the register
  • type (SoftRegType or str) – Type of the register
  • addr (int) – Base address of the register in bytes
  • width (int) – Number of bits of this register
  • bytewidth (int) – Number of bytes that this register takes in the address space. Always a power of 2
  • rstval (int) – Reset value
_addr
_bytewidth
_name
_rstval
_type
_width
addr

Base address of the register in bytes.

Type:int
bytewidth

Number of bytes that this register takes in the address space. Always a power of 2.

Type:int
has_port_i

Tests if the soft register has input port var_{name}_i.

Type:bool
has_port_o

Tests if the soft register has input port var_{name}_o.

Type:bool
name

Name of the register.

Type:str
rstval

Reset value.

Type:int
type_

Type of the register.

Type:SoftRegType
width

Number of bits of this register.

Type:int
class prga.app.softregs.SoftRegIntf(addr_width=11, align=8, strb=False)

Bases: prga.util.Object

Soft register interface.

Parameters:
  • addr_width (int) – Number of bits in the address. This sets the maximum address space
  • align (int) – Byte alignment. Must be power of 2. This also sets the maximum width of all soft registers
  • strb (bool) – If set, write strobe per write is used instead of a single read/write signal
add_softreg(type_, name, rstval=0, *, addr=None, width=None)

Add one soft register to the interface.

Parameters:
  • type (SoftRegType or str) – Type of the soft register
  • name (str) – Name of the soft register
  • rstval (int) – Reset value of the register
Keyword Arguments:
 
  • addr (int) – Base address of the register in bytes. Automatically allocated if left unspecified
  • width (int) – Number of the bits of the register. Default to 8bits x alignment
Returns:

The created soft register

Return type:

SoftReg

addr_width
addrspace
align
create_module()

Create a Module object implementing this soft register interface.

Returns:
Return type:Module
classmethod from_fabric_intf(intf)

Create SoftRegIntf from FabricIntf._softreg.

Parameters:intf (FabricIntf._softreg) –
Returns:
Return type:SoftRegIntf
regs
strb
class prga.app.softregs.SoftRegType

Bases: prga.util.Enum

Soft register types.

bar = 4

burnt-after-read

basic = 100

read-write registers that hold the value once written

busywait = 104

read-write registers. write is blocked until busy is deasserted. read returns busy value

cbl = 5

call-by-load. assert output until ack’ed

cbl_2stage = 6

call-by-load. 2-stage ack (output ack, then done signal)

const = 0

read-only registers with constant value

decoupled = 103

write to kernel and read from kernel

kernel = 1

read-only registers inside the kernel

pulse = 101

read-write registers that auto-reset after one cycle (read always return rstval)

pulse_ack = 102

read-write registers that block until kernel acks and auto-reset (read returns current value)

rdempty = 2

read-only registers inside the kernel with FIFO-like hand-shake

rdempty_la = 3

read-only registers inside the kernel with lookahead FIFO-like hand-shake

wrfull = 200

write-only registers inside the kernel with FIFO-like hand-shake