hwtLib.peripheral.mdio package

Submodules

hwtLib.peripheral.mdio.intf module

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

Bases: IntfIpMeta

__annotations__ = {}
__init__()[source]
library
name
vendor
version
class hwtLib.peripheral.mdio.intf.Mdio(masterDir=DIRECTION.OUT, hdlName: str | dict[str, str] | None = None, loadConfig=True)[source]

Bases: HwIO

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

  • 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:
  • CLK_FREQ - default value 2500000 of type int

HDL IO:
  • c - of type hwt.hwIOs.std.HwIOClk with dtype=<HBits, 1bit> - UNKNOWN

  • io - of type hwt.hwIOs.hwIOTristate.HwIOTristateSig - UNKNOWN

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 = <HBitsConst b32 4294967295>
PRE_W = 32
RA_W = 5
ST = <HBitsConst b2 1>
ST_W = 2
TA = <HBitsConst b2 2>
TA_W = 2
__annotations__ = {}
_getIpCoreIntfClass()[source]
_initSimAgent(sim: HdlSimulator)[source]
class hwtLib.peripheral.mdio.intf.MdioAgent(sim: HdlSimulator, hwIO, allowNoReset=False)[source]

Bases: SyncAgentBase

PULL = 1
__annotations__ = {}
__init__(sim: HdlSimulator, hwIO, allowNoReset=False)[source]
Parameters:

rst – tuple (rst signal, rst_negated flag)

getMonitors()[source]
Note:

use only before running simulator

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

Receive 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, hdlName: str | dict[str, str] | None = None, loadConfig=True)[source]

Bases: HwIO

HDL IO:
  • phy - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 5bits> - UNKNOWN

  • reg - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 5bits> - UNKNOWN

__annotations__ = {}
class hwtLib.peripheral.mdio.master.MdioMaster(hdlName: str | None = None)[source]

Bases: HwModule

Master for MDIO interface.

Variables:
  • ~.CLK_FREQ – frequency of input clock

  • ~.MDIO_FREQ – frequency of output MDIO clock

HDL params:
  • CLK_FREQ - default value 100000000 of type int

  • MDIO_FREQ - default value 2500000 of type int

HDL IO:
schematic
__annotations__ = {}
_packet_sequence_timer(mdio_clk_rising: HBitsRtlSignal, mdio_clk_falling: HBitsRtlSignal, rst: HBitsRtlSignal)[source]

Create timers for all important events in protocol main FSM

class hwtLib.peripheral.mdio.master.MdioReq(masterDir=DIRECTION.OUT, hdlName: str | dict[str, str] | None = None, loadConfig=True)[source]

Bases: HwIORdVldSync

MDIO transaction request interface

HDL IO:
  • opcode - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 2bits> - UNKNOWN

  • addr - of type hwtLib.peripheral.mdio.master.MdioAddr - UNKNOWN

  • wdata - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 16bits> - UNKNOWN

  • vld - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN

  • rd - of type hwt.hwIOs.std.HwIOSignal with dtype=<HBits, 1bit> - UNKNOWN (Master=IN)

__annotations__ = {}
_initSimAgent(sim: HdlSimulator)[source]
class hwtLib.peripheral.mdio.master.MdioReqAgent(sim: HdlSimulator, hwIO: HwIODataRdVld, allowNoReset=False)[source]

Bases: HwIODataRdVldAgent

Simulation agent for MdioReq interface

__annotations__ = {}
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