hwtLib.peripheral.mdio package

Submodules

hwtLib.peripheral.mdio.intf module

class hwtLib.peripheral.mdio.intf.IP_mdio[source]

Bases: IntfIpMeta

__init__()[source]
library
name
vendor
version
class hwtLib.peripheral.mdio.intf.Mdio(masterDir=DIRECTION.OUT, hdl_name: Optional[Union[str, Dict[str, str]]] = None, loadConfig=True)[source]

Bases: Interface

Management Data Input/Output (MDIO), also known as Serial Management Interface (SMI) or Media Independent Interface Management (MIIM), is a serial bus defined for the Ethernet family of IEEE 802.3 standards for the Media Independent Interface,

  • MDIO packet format: <PRE><ST><OP><PA><RA><TA><D>

    • PRE: 32b preamble

    • ST: 2b start field

    • OP: 2b operation code

    • PA: 5b PHY address

    • RA: 5b register address

    • TA: 2b turn arround

    • D 16b data

HDL params
  • FREQ - default value 2500000 of type int

HDL IO
ADDR_BLOCK_W = 14
DEFAULT_FREQ = 2500000
D_W = 16
class OP[source]

Bases: object

READ = 2
WRITE = 1
OP_W = 2
PA_W = 5
PRE = <BitsVal 4294967295>
PRE_W = 32
RA_W = 5
ST = <BitsVal 1>
ST_W = 2
TA = <BitsVal 2>
TA_W = 2
_getIpCoreIntfClass()[source]
_initSimAgent(sim: HdlSimulator)[source]
class hwtLib.peripheral.mdio.intf.MdioAgent(sim: HdlSimulator, intf, allowNoReset=False)[source]

Bases: SyncAgentBase

PULL = 1
__init__(sim: HdlSimulator, intf, allowNoReset=False)[source]
Parameters

rst – tuple (rst signal, rst_negated flag)

getMonitors()[source]

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

on_read(phyaddr, regaddr)[source]
on_write(phyaddr, regaddr, data)[source]
reset_state()[source]
rx_bits()[source]

Recieve bit from io tristate signal on rising edge of c clock

tx_bits()[source]

Transmit bit to io tristate signal on falling edge of c clock

unpack_addr(rx_bits) Tuple[int, int, int][source]
hwtLib.peripheral.mdio.intf.pop_int(bits: Deque[int], bit_cnt: int)[source]

hwtLib.peripheral.mdio.master module

class hwtLib.peripheral.mdio.master.MdioAddr(masterDir=DIRECTION.OUT, hdl_name: Optional[Union[str, Dict[str, str]]] = None, loadConfig=True)[source]

Bases: Interface

HDL IO
class hwtLib.peripheral.mdio.master.MdioMaster(hdl_name_override: Optional[str] = None)[source]

Bases: Unit

Master for MDIO interface.

Variables
  • ~.FREQ – frequency of input clock

  • ~.MDIO_FREQ – frequency of output MDIO clock

HDL params
  • FREQ - default value 100000000 of type int

  • MDIO_FREQ - default value 2500000 of type int

HDL IO
schematic
_packet_sequence_timer(mdio_clk_rising, mdio_clk_falling, rst_n)[source]

Create timers for all important events in protocol main FSM

class hwtLib.peripheral.mdio.master.MdioReq(masterDir=DIRECTION.OUT, hdl_name: Optional[Union[str, Dict[str, str]]] = None, loadConfig=True)[source]

Bases: HandshakeSync

MDIO transaction request interface

HDL IO
_initSimAgent(sim: HdlSimulator)[source]
class hwtLib.peripheral.mdio.master.MdioReqAgent(sim: HdlSimulator, intf: Handshaked, allowNoReset=False)[source]

Bases: HandshakedAgent

Simulation agent for MdioReq interface

get_data()[source]

extract data from interface

set_data(data)[source]

write data to interface

hwtLib.peripheral.mdio.master.shift_in_msb_first(reg, sig_in)[source]

Shift data in to register, MSB first