hwtLib.mem package

Submodules

hwtLib.mem.bramPortEndpoint module

class hwtLib.mem.bramPortEndpoint.BramPortEndpoint(structTemplate, intfCls=<class 'hwt.interfaces.std.BramPort_withoutClk'>, shouldEnterFn=None)[source]

Bases: hwtLib.abstract.busEndpoint.BusEndpoint

Delegate transaction from BrapmPort interface to interfaces for fields of specified structure.

Attention

Interfaces are dynamically generated from names of fields in structure template.

schematic
__init__(structTemplate, intfCls=<class 'hwt.interfaces.std.BramPort_withoutClk'>, shouldEnterFn=None)[source]
Parameters
  • structTemplate – instance of HStruct which describes address space of this endpoint

  • intfCls – class of bus interface which should be used

  • shouldEnterFn – function(root_t, structFieldPath) return (shouldEnter, shouldUse) where shouldEnter is flag that means iterator over this interface should look inside of this actual object and shouldUse flag means that this field should be used (to create interface)

_getAddrStep()
Returns

how many bits is one unit of address (f.e. 8 bits for char * pointer, 36 for 36 bit bram)

_getWordAddrStep()
Returns

size of one word in unit of address

_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

hwtLib.mem.bramPortEndpoint._example_BramPortEndpoint()[source]

hwtLib.mem.bramPortSimMemSpaceMaster module

class hwtLib.mem.bramPortSimMemSpaceMaster.BramPortSimMemSpaceMaster(bus, registerMap)[source]

Bases: hwtLib.sim.abstractMemSpaceMaster.AbstractMemSpaceMaster

Controller of BramPort simulation agent which keeps track of transactions and allows struct like data access

_read(addr, size, onDone)[source]

Add read transaction to agent of interface :param addr: address value on bus to read froms :param size: size of data to read in bites :param onDone: on read done callback function(sim) -> None

_write(addr, size, data, mask, onDone=None)[source]

Add write transaction to agent of interface

Parameters
  • addr – address value on bus to write on

  • size – size of data to write in bites

  • data – data to write on bus

  • onDone – on write done callback function(sim) -> None

hwtLib.mem.cam module

class hwtLib.mem.cam.Cam[source]

Bases: hwt.synthesizer.unit.Unit

Content addressable memory. MATCH_LATENCY = 1

Note

Simple combinational version

schematic
_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

static _serializeDecision(parentUnit, priv)

Decide to serialize only objs with uniq parameters and class

Parameters

priv – private data for this function ({frozen_params: obj})

Returns

tuple (do serialize this object, next priv, replacement unit)

matchHandler(mem)[source]
writeHandler(mem)[source]

hwtLib.mem.cuckooHashTablWithRam module

class hwtLib.mem.cuckooHashTablWithRam.CuckooHashTableWithRam(polynomials)[source]

Bases: hwtLib.mem.cuckooHashTable.CuckooHashTable

A cuckoo hash table core with integrated memory

schematic
__init__(polynomials)[source]

Initialize self. See help(type(self)) for accurate signature.

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

hwtLib.mem.cuckooHashTablWithRam._example_CuckooHashTableWithRam()[source]

hwtLib.mem.cuckooHashTable module

class hwtLib.mem.cuckooHashTable.CuckooHashTable[source]

Bases: hwtLib.mem.hashTableCore.HashTableCore

Cuckoo hash uses more tables with different hash functions

Lookup is performed in all tables at once and if item is found in any table. The item is found. Otherwise item is not in tables. lookup time: O(1)

Insert has to first lookup if item is in any table. If any table contains invalid item. The item is stored there and insert operation is complete. If there was a valid item under this key in all tables. One is selected and it is swapped with current item. Insert process then repeats with this item. Until some invalid item (empty slot) is found.

Inserting into table does not have to be successful and in this case, fsm ends up in infinite loop and it will be reinserting items for ever. insert time: O(inf)

_images/aafig-738f527550873e35eea2e9dd3cf3f11b5808e8de.gif schematic
__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_declr_outer_io()[source]
_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

clean_addr_iterator(en)[source]
configure_tables(tables: List[hwtLib.mem.hashTableCore.HashTableCore])[source]

share the configuration with the table engines

insertRes_driver(state, stash, insertAck, insertFinal, isDelete)[source]
insert_addr_select(insertTargetOH, state, cleanAddr)[source]

Select a insert address

lookupRes_driver(state: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, lookupFoundOH: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal)[source]

If lookup request comes from external interface “lookup” propagate results from tables to “lookupRes”.

lookup_trans_cntr()[source]

create a counter of pure lookup operations in progress

stash_load(isIdle, lookupResNext, insertTargetOH, stash, lookup_not_in_progress, another_lookup_possible)[source]

load a stash register from lookup/insert/delete interface

tables_insert_driver(state: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, insertTargetOH: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, insertIndex: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, stash: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal)[source]
Parameters
  • state – state register of main FSM

  • insertTargetOH – index of table where insert should be performed, one hot encoding

  • insertIndex – address for table where item should be placed

  • stash – stash register with data for insert/lookup/delete from table

tables_lookupRes_resolver(insertResRead: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal)[source]

Control lookupRes interface for each table

tables_lookup_driver(state: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, tableKey: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, lookup_en: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal)[source]

Connect a lookup ports of all tables

hwtLib.mem.cuckooHashTable_intf module

class hwtLib.mem.cuckooHashTable_intf.CInsertIntf(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwt.interfaces.std.HandshakeSync

Cuckoo hash insert interface

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.cuckooHashTable_intf.CInsertIntfAgent(sim, intf)[source]

Bases: hwt.interfaces.agents.handshaked.HandshakedAgent

Agent for CInsertIntf interface

__init__(sim, intf)[source]
Parameters

rst – tuple (rst signal, rst_negated flag)

get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface

class hwtLib.mem.cuckooHashTable_intf.CInsertResIntf(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwtLib.mem.cuckooHashTable_intf.CInsertIntf

An interface with an result of insert operation.

Variables

pop – signal if 1 the key and data on this interface contains the item which had to be removed during insert because the insertion limit was exceeded

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.cuckooHashTable_intf.CInsertResIntfAgent(sim, intf)[source]

Bases: hwtLib.mem.cuckooHashTable_intf.CInsertIntfAgent

Agent for CInsertResIntf interface

get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface

hwtLib.mem.fifo module

class hwtLib.mem.fifo.Fifo[source]

Bases: hwt.synthesizer.unit.Unit

Generic FIFO usually mapped to BRAM.

Variables
  • EXPORT_SIZE – parameter, if true “size” signal will be exported

  • size – optional signal with count of items stored in this fifo

  • EXPORT_SPACE – parameter, if true “space” signal is exported

  • space – optional signal with count of items which can be added to this fifo

schematic
_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

static _serializeDecision(parentUnit, priv)

Decide to serialize only objs with uniq parameters and class

Parameters

priv – private data for this function ({frozen_params: obj})

Returns

tuple (do serialize this object, next priv, replacement unit)

fifo_pointers(DEPTH: int, write_en_wait: Tuple[hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal], read_en_wait_list: List[Tuple[hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal]]) → List[Tuple[hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal]][source]

Create fifo writer and reader pointers and enable/wait logic This functions supports multiple reader pointers

Attention

writer pointer next logic check only last reader pointer

Returns

list, tule(en, ptr) for writer and each reader

hwtLib.mem.fifo._example_Fifo()[source]

hwtLib.mem.fifoArray module

class hwtLib.mem.fifoArray.FifoArray[source]

Bases: hwt.synthesizer.unit.Unit

This component is an array of list nodes, which can be used to emulate multiple FIFOs. The memory is shared and the number of lists stored in this array is limited only by memory.

Corresponds to data structure:

// note that in implementation each part of struct item is stored in separate array
struct item {
  value_t value;
  item * next;
  bool valid;
  bool last;
};

item items[ITEMS];
Note

The insert_addr is used to pop from specific list. The list can be read only from it’s head in FIFO order manner. Item is last if it’s next pointer points on this item.

Note

DistRAM implementation.

Note

The pop address is not checked it is possible to pop from wrong list if address is specified incorrectly

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

class hwtLib.mem.fifoArray.FifoArrayInsertInterface(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwtLib.handshaked.intfBiDirectional.HandshakedBiDirectional

Variables
  • append – if append = 1 the item is appended to last list item specified using “addr” else new list is created and “addr” value is ignored

  • addr – an address with potential end of the list

  • data – data to store in next list node

  • addr_ret – an address where the item was inserted to

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.fifoArray.FifoArrayInsertInterfaceAgent(sim, intf)[source]

Bases: hwtLib.handshaked.intfBiDirectional.HandshakedBiDirectionalAgent

Simulation agent for FifoArrayInsertInterface interface

get_data()[source]

extract data from interface

onDriverWriteAck()[source]

read din

onMonitorReady()[source]

write din

set_data(data)[source]

write data to interface

class hwtLib.mem.fifoArray.FifoArrayPopInterface(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwtLib.common_nonstd_interfaces.addr_data_hs_bidir.AddrInDataOutHs

Variables
  • addr – the address of the list head to read from:

  • data – the return data which was read

  • last – flag which tell if this node was last in this list and thus this list is now empty and deallocated

  • addr_next – address on a next item in this FIFO

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.fifoArray.FifoArrayPopInterfaceAgent(sim, intf)[source]

Bases: hwtLib.common_nonstd_interfaces.addr_data_hs_bidir.AddrInDataOutHsAgent

Simulation agent for FifoArrayPopInterfaceAgent interface

get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface

hwtLib.mem.fifoAsync module

class hwtLib.mem.fifoAsync.FifoAsync[source]

Bases: hwtLib.mem.fifo.Fifo

Asynchronous fifo using BRAM/LUT memory, based on: * https://github.com/ZipCPU/website/blob/master/examples/afifo.v * https://github.com/alexforencich/verilog-axis/blob/master/rtl/axis_async_fifo.v

schematic
_addr_reg_and_cdc(reg_name, clk_in, clk_out)[source]

Create a register for head/tail FIFO reader/writter possition with gray encoded value propagated to other clock domain

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

static _serializeDecision(parentUnit, priv)

Decide to serialize only objs with uniq parameters and class

Parameters

priv – private data for this function ({frozen_params: obj})

Returns

tuple (do serialize this object, next priv, replacement unit)

hwtLib.mem.fifoAsync._example_FifoAsync()[source]

hwtLib.mem.fifo_drop module

class hwtLib.mem.fifo_drop.FifoDrop[source]

Bases: hwtLib.mem.fifo.Fifo

See

hwtLib.mem.fifo

Fifo with an extra signals for writter which allows to commit or discard data chung writen in to fifo.

Attention

the commit/drop logic is executed on write but also during dataIn.wait=1 this allows for droping if FIFO is full of uncommited data

schematic
_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

static _serializeDecision(parentUnit, priv)

Decide to serialize only objs with uniq parameters and class

Parameters

priv – private data for this function ({frozen_params: obj})

Returns

tuple (do serialize this object, next priv, replacement unit)

class hwtLib.mem.fifo_drop.FifoWriterDropable(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwt.interfaces.std.FifoWriter

FIFO write port interface witch commit and discard signal used to drop data chunks already written in fifo

Note

commit and discard behaves as another data signal it is valid if en=1

Note

only one from “commit”, “discard” can be 1 at the same time

Variables
  • commit – if 1 all the written data are made available to reader, including current data word

  • discard – if 1 all written data which were not commited are discarded includeing current data word

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_getIpCoreIntfClass()[source]
_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.fifo_drop.FifoWriterDropableAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf, allowNoReset=False)[source]

Bases: hwt.interfaces.agents.fifo.FifoWriterAgent

get_data()[source]
set_data(d)[source]
hwtLib.mem.fifo_drop._example_FifoDrop()[source]

hwtLib.mem.hashTableCore module

class hwtLib.mem.hashTableCore.HashTableCore(polynome)[source]

Bases: hwt.synthesizer.unit.Unit

Generic hash table, in block RAM there is a input key which is hashed ad this has is used as an index into memory item on this place is checked and returned on “lookupRes” interface (item does have to be found, see “found” flag in LookupResultIntf)

memory is an array of items in format

struct item {
    bool item_vld;
    data_t data;
    key_t key;
};
Variables
  • ITEMS_CNT – number of items in memory of hash table

  • KEY_WIDTH – width of the key used by hash table

  • DATA_WIDTH – width of data, can be zero and then no data interface is instantiated

  • LOOKUP_ID_WIDTH – width of id signal for lookup (tag used only by parent component to mark this lookup for later result processing, can be 0)

  • LOOKUP_HASH – flag if lookup interface should have hash signal

  • LOOKUP_KEY – flag if lookup interface should have key signal

  • POLYNOME – polynome for crc hash used in this table

_images/aafig-b0e5526d02b708665a1b33a44b1e3844ece9976f.gif schematic
__init__(polynome)[source]

Initialize self. See help(type(self)) for accurate signature.

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_declr_common()[source]
_impl(r: Optional[hwtLib.handshaked.ramAsHs.RamHsR] = None, w: Optional[hwtLib.common_nonstd_interfaces.addr_data_hs.AddrDataHs] = None)[source]

implementations

  • implement functionality of componnent there

  • called after _declr

insertLogic(ramW: hwtLib.common_nonstd_interfaces.addr_data_hs.AddrDataHs)[source]
lookupLogic(ramR: hwtLib.handshaked.ramAsHs.RamHsR)[source]
parseItem(sig)[source]

Parse data stored in hash table

hwtLib.mem.hashTableCore._example_HashTableCore()[source]

hwtLib.mem.hashTableCoreWithRam module

class hwtLib.mem.hashTableCoreWithRam.HashTableCoreWithRam(polynome)[source]

Bases: hwtLib.mem.hashTableCore.HashTableCore

schematic
_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl(r=None, w=None)[source]

implementations

  • implement functionality of componnent there

  • called after _declr

hwtLib.mem.hashTableCoreWithRam._example_HashTableCoreWithRam()[source]

hwtLib.mem.hashTable_intf module

class hwtLib.mem.hashTable_intf.HashTableIntf(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwt.synthesizer.interface.Interface

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.hashTable_intf.HashTableIntfAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf: hwtLib.mem.hashTable_intf.HashTableIntf)[source]

Bases: pycocotb.agents.base.AgentBase

__init__(sim: pycocotb.hdlSimulator.HdlSimulator, intf: hwtLib.mem.hashTable_intf.HashTableIntf)[source]

Initialize self. See help(type(self)) for accurate signature.

getDrivers()[source]

Called before simulation to collect all drivers of interfaces from this agent

getMonitors()[source]

Called before simulation to collect all monitors of interfaces from this agent

class hwtLib.mem.hashTable_intf.InsertIntf(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwt.interfaces.std.HandshakeSync

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.hashTable_intf.InsertIntfAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf: hwtLib.mem.hashTable_intf.InsertIntf)[source]

Bases: hwt.interfaces.agents.handshaked.HandshakedAgent

Simulation agent for .InsertIntf interface

data format:
  • if interface has data signal, data format is tuple (hash, key, data, item_vld)

  • if interface does not have data signal, data format is tuple (hash, key, item_vld)

__init__(sim: pycocotb.hdlSimulator.HdlSimulator, intf: hwtLib.mem.hashTable_intf.InsertIntf)[source]
Parameters

rst – tuple (rst signal, rst_negated flag)

get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface

class hwtLib.mem.hashTable_intf.LookupKeyIntf(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwt.interfaces.std.HandshakeSync

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.hashTable_intf.LookupKeyIntfAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf: hwtLib.mem.hashTable_intf.LookupKeyIntf)[source]

Bases: hwt.interfaces.agents.handshaked.HandshakedAgent

Simulation agent for LookupKeyIntf interface

__init__(sim: pycocotb.hdlSimulator.HdlSimulator, intf: hwtLib.mem.hashTable_intf.LookupKeyIntf)[source]
Parameters

rst – tuple (rst signal, rst_negated flag)

get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface

class hwtLib.mem.hashTable_intf.LookupResultIntf(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwt.interfaces.std.Handshaked

Interface for result of lookup in hash table

Variables
  • HASH_WIDTH – width of the hash used by hash table

  • KEY_WIDTH – width of the key used by hash table

  • LOOKUP_HASH – flag if this interface should have hash signal

  • LOOKUP_KEY – flag if this interface should have hash signal

  • hash – hash for this key (= index in this table)

  • key – original key which was searched for

  • data – data under this key

  • occupied – flag which tells if there is an valid item under this key

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.mem.hashTable_intf.LookupResultIntfAgent(sim, intf)[source]

Bases: hwt.interfaces.agents.handshaked.HandshakedAgent

Simulation agent for .LookupResultIntf data is stored in .data data format is tuple (hash, key, data, found) but some items can be missing depending on configuration of interface

__init__(sim, intf)[source]
Parameters

rst – tuple (rst signal, rst_negated flag)

get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface

hwtLib.mem.lutRam module

class hwtLib.mem.lutRam.RAM64X1S

Bases: hwt.synthesizer.unit.Unit

_config()

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl()

implementations

  • implement functionality of componnent there

  • called after _declr

static _serializeDecision(parentUnit, priv)

Always decide not to serialize obj

Parameters

priv – private data for this function first unit of this class

Returns

tuple (do serialize this object, next priv, replacement unit)

hwtLib.mem.lutRam.mkLutRamCls(DATA_WIDTH)[source]

Lut ram generator, hdl code will be excluded from serialization because we expect vendor library to contains it

hwtLib.mem.ram module

class hwtLib.mem.ram.RamMultiClock[source]

Bases: hwt.synthesizer.unit.Unit

RAM where each port has an independet clock. It can be configured to true dual port RAM etc.

Note

write-first variant

schematic
PORT_CLS

alias of hwt.interfaces.std.BramPort

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

static _serializeDecision(parentUnit, priv)

Decide to serialize only objs with uniq parameters and class

Parameters

priv – private data for this function ({frozen_params: obj})

Returns

tuple (do serialize this object, next priv, replacement unit)

class hwtLib.mem.ram.RamSingleClock[source]

Bases: hwt.synthesizer.unit.Unit

RAM with only one clock signal

Note

This memory may not be mapped to RAM if synthesis tool consider it to be too small.

Variables
  • PORT_CNT – Param which specifies number of ram ports, it can be int or tuple of READ_WRITE, WRITE, READ to specify rw access for each port separately

  • HAS_BE – Param, if True the write ports will have byte enable signal

schematic
PORT_CLS

alias of hwt.interfaces.std.BramPort_withoutClk

_config()[source]

Configure object parameters

  • setup all parameters on this object, use Param class instances to allow use of parameter inheritance

  • called in __init__ of class

_declr()[source]

declarations

  • do all declarations of externally accessible objects there (Interfaces)

  • _declr method is called after _config

  • if this object is Unit all interfaces are threated as externally accessible interfaces if this object is Interface instance all subinterfaces are loaded as well

_declr_children()[source]
_declr_ports()[source]
_impl()[source]

implementations

  • implement functionality of componnent there

  • called after _declr

static _serializeDecision(parentUnit, priv)

Decide to serialize only objs with uniq parameters and class

Parameters

priv – private data for this function ({frozen_params: obj})

Returns

tuple (do serialize this object, next priv, replacement unit)

static connect_port(clk: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal, port: hwt.interfaces.std.BramPort_withoutClk, mem: hwt.synthesizer.rtlLevel.rtlSignal.RtlSignal)[source]
delegate_to_children()[source]
static mem_write(mem, port: hwt.interfaces.std.BramPort_withoutClk)[source]