hwtLib.avalon package

This package contains definitions of Avalon interfaces, simulation agents and some componets.

Avalon interfaces were used in many projects around 2015. In 2018 it is still main bus in intel(altera) Quartus (FPGA devel. IDE).

Most commonly used Avalon interfaces are: * AvalonMM (memory mapped) * AvalonST (stream)

Submodules

hwtLib.avalon.endpoint module

class hwtLib.avalon.endpoint.AvalonMmEndpoint(structTemplate, intfCls=<class 'hwtLib.avalon.mm.AvalonMM'>, shouldEnterFn=None)[source]

Bases: hwtLib.abstract.busEndpoint.BusEndpoint

Delegate request from bus to fields of structure

Attention

interfaces are dynamically generated from names of fileds in structure template

Attention

byte enable and register clock enable signals are ignored

schematic
__init__(structTemplate, intfCls=<class 'hwtLib.avalon.mm.AvalonMM'>, 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.avalon.endpoint._example_AvalonMmEndpoint()[source]

hwtLib.avalon.memSpaceMaster module

class hwtLib.avalon.memSpaceMaster.AvalonMmMemSpaceMaster(bus, registerMap)[source]

Bases: hwtLib.sim.abstractMemSpaceMaster.AbstractMemSpaceMaster

Controller of AvalonMM simulation agent which keeps track of axi lite transactions and aggregates them to proper register names on target bus

__init__(bus, registerMap)[source]

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

_read(addr, size, onDone=None)[source]

add read address transaction to agent

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

add write address and write data to agent

Parameters

onDone – callback function(sim) -> None

class hwtLib.avalon.memSpaceMaster.TupleWithCallback(*args)[source]

Bases: tuple

hwtLib.avalon.mm module

class hwtLib.avalon.mm.AvalonMM(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwt.synthesizer.interface.Interface

Avalon Memory Mapped interface

Note

handshaked, shared address and response channel

https://www.intel.com/content/dam/altera-www/global/en_US/pdfs/literature/manual/mnl_avalon_spec.pdf

_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

_getAddrStep()[source]
Returns

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

_getWordAddrStep()[source]
Returns

size of one word in unit of address

_initSimAgent(sim: pycocotb.hdlSimulator.HdlSimulator)[source]
class hwtLib.avalon.mm.AvalonMmAddrAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf, allowNoReset=False)[source]

Bases: hwt.interfaces.agents.handshaked.HandshakedAgent

data format is tuple (address, byteEnable, read/write, burstCount)

  • two valid signals “read”, “write”

  • one ready_n signal “waitrequest”)

  • on write set data and byteenamble as well

__init__(sim: pycocotb.hdlSimulator.HdlSimulator, intf, allowNoReset=False)[source]
Parameters

rst – tuple (rst signal, rst_negated flag)

get_data()[source]

extract data from interface

get_ready()[source]

get value of “ready” signal

classmethod get_ready_signal(intf)[source]
get_valid()[source]

get “valid” signal

classmethod get_valid_signal(intf)[source]
set_data(data)[source]

write data to interface

set_ready(val)[source]
set_valid(val)[source]
class hwtLib.avalon.mm.AvalonMmAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf, allowNoReset=False)[source]

Bases: hwt.simulator.agentBase.SyncAgentBase

Simulation agent for AvalonMM bus interface

Variables
  • req – request data, items are tuples (READ/WRITE, address, burstCount)

  • wData – data to write, items are tuples (data, byteenable)

  • wResp – write response data

  • rData – data read from interface, items are typles (data, response)

__init__(sim: pycocotb.hdlSimulator.HdlSimulator, intf, allowNoReset=False)[source]
Parameters

rst – tuple (rst signal, rst_negated flag)

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

property rData
rData_get()[source]
rData_set(v)[source]
property req
req_get()[source]
req_set(v)[source]
property wData
wData_get()[source]
wData_set(v)[source]
property wResp
wResp_get()[source]
wResp_set(v)[source]
class hwtLib.avalon.mm.AvalonMmDataRAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf, allowNoReset=False)[source]

Bases: hwt.interfaces.agents.vldSynced.VldSyncedAgent

Simulation/verification agent for data part of AvalomMM interface

  • vld signal = readDataValid

  • data signal = (readData, response)

get_data()[source]

extract data from interface

get_valid()[source]
classmethod get_valid_signal(intf)[source]
set_data(data)[source]

write data to interface

set_valid(val)[source]
class hwtLib.avalon.mm.AvalonMmWRespAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf, allowNoReset=False)[source]

Bases: hwt.interfaces.agents.vldSynced.VldSyncedAgent

get_data()[source]
classmethod get_valid_signal(intf)[source]
set_data(data)[source]

hwtLib.avalon.st module

class hwtLib.avalon.st.AvalonST(masterDir=<DIRECTION.OUT: 1>, loadConfig=True)[source]

Bases: hwt.interfaces.std.Handshaked

Avalon stream interface

Note

handshaked stream with cahnnel, error, sof, eof signal

_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.avalon.st.AvalonSTAgent(sim: pycocotb.hdlSimulator.HdlSimulator, intf, allowNoReset=False)[source]

Bases: hwt.interfaces.agents.handshaked.HandshakedAgent

Simulation Agent for AvalonST interface Data is stored in .data property and data format is tuple (channel, data, error, startOfPacket, endOfPacket)

get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface