hwtLib.i2c package

Submodules

hwtLib.i2c.intf module

class hwtLib.i2c.intf.I2c(masterDir=<DIRECTION.OUT: 1>, asArraySize=None, loadConfig=True)[source]

Bases: hwt.synthesizer.interface.Interface

_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 threaten as externally accessible interfaces if this object is Interface all subinterfaces are loaded
_getIpCoreIntfClass()[source]
_initSimAgent()[source]
class hwtLib.i2c.intf.I2cAgent(intf, allowNoReset=True)[source]

Bases: hwt.simulator.agentBase.AgentWitReset

START = 'start'
__init__(intf, allowNoReset=True)[source]

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

driver(sim)[source]

Implement this method to drive your interface in simulation/verification

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

monitor(sim)[source]

Implement this method to monitor your interface in simulation/verification

startListener(sim)[source]
startSender(sim)[source]
class hwtLib.i2c.intf.IP_IIC[source]

Bases: hwt.serializer.ip_packager.interfaces.intfConfig.IntfConfig

__init__()[source]

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

hwtLib.i2c.masterBitCntrl module

class hwtLib.i2c.masterBitCntrl.I2cBitCntrlCmd(masterDir=<DIRECTION.OUT: 1>, asArraySize=None, loadConfig=True)[source]

Bases: hwt.interfaces.std.RdSynced

_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 threaten as externally accessible interfaces if this object is Interface all subinterfaces are loaded
_initSimAgent()[source]
class hwtLib.i2c.masterBitCntrl.I2cBitCntrlCmdAgent(intf, allowNoReset=True)[source]

Bases: hwt.interfaces.agents.rdSynced.RdSyncedAgent

doRead(s)[source]

extract data from interface

doWrite(s, data)[source]

write data to interface

class hwtLib.i2c.masterBitCntrl.I2cMasterBitCtrl[source]

Bases: hwt.synthesizer.unit.Unit

Translate simple commands into SCL/SDA transitions Each command has 5 states, 0/1/2/3/idle

_images/aafig-3d6c1ab1cf1f89661eea720a668ebe2c986a855c.gif
Timing: Normal mode Fast mode
Fscl 100KHz 400KHz
Th_scl 4.0us 0.6us High period of SCL
Tl_scl 4.7us 1.3us Low period of SCL
Tsu:sta 4.7us 0.6us setup time for a repeated start condition
Tsu:sto 4.0us 0.6us setup time for a stop condition
Tbuf 4.7us 1.3us Bus free time between a stop and start condition
_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 threaten as externally accessible interfaces if this object is Interface all subinterfaces are loaded
_impl()[source]

implementations

  • implement functionality of design there
  • called after _declr
arbitrationLostDriver(st, sda, sda_chk, sda_t, stopCond, stateClkEn)[source]

aribitration lost when:

  1. master drives SDA high, but the i2c bus is low
  2. stop detected while not requested (detect during ‘idle’ state)
detectStartAndStop(scl, sda, scl_t)[source]
Attention:also dout driver
filter(name, sig)[source]

attempt to remove glitches

stateClkGen(scl_sync, scl_t, scl)[source]
hwtLib.i2c.masterBitCntrl.hasFallen(last, actual)[source]
hwtLib.i2c.masterBitCntrl.hasRisen(last, actual)[source]

Module contents