Beispiel #1
0
 def __init__(self,
              structT,
              instantiateFieldFn,
              masterDir=DIRECTION.OUT,
              loadConfig=True):
     Interface.__init__(self, masterDir=masterDir, loadConfig=loadConfig)
     self._structT = structT
     self._instantiateFieldFn = instantiateFieldFn
     self._fieldsToInterfaces = {}
Beispiel #2
0
 def _clean(self, lockNonExternal=True):
     """
     :see: :func:`Interface._clean`
     """
     self._sigInside = self._sig
     self._sig = None
     if lockNonExternal and not self._isExtern:
         self._isAccessible = False
     if self._interfaces:
         Interface._clean(self, lockNonExternal=lockNonExternal)
Beispiel #3
0
 def __init__(self,
              structT: HStruct,
              field_path: Tuple[Union[str, int], ...],
              instantiateFieldFn,
              masterDir=DIRECTION.OUT,
              loadConfig=True):
     Interface.__init__(self, masterDir=masterDir, loadConfig=loadConfig)
     if not field_path:
         field_path = tuple()
     self._field_path = field_path
     self._structT = structT
     self._instantiateFieldFn = instantiateFieldFn
     self._fieldsToInterfaces = {}
Beispiel #4
0
 def __init__(self,
              structT: HStruct,
              field_path: TypePath,
              instantiateFieldFn,
              masterDir=DIRECTION.OUT,
              loadConfig=True):
     Interface.__init__(self, masterDir=masterDir, loadConfig=loadConfig)
     if not field_path:
         field_path = TypePath()
     else:
         assert isinstance(field_path, TypePath), field_path
     self._field_path = field_path
     self._structT = structT
     self._instantiateFieldFn = instantiateFieldFn
     self._fieldsToInterfaces = {}
Beispiel #5
0
    def __init__(self,
                 structT: HStruct,
                 field_path: TypePath,
                 instantiateFieldFn,
                 masterDir=DIRECTION.OUT,
                 loadConfig=True):
        Interface.__init__(self, masterDir=masterDir, loadConfig=loadConfig)
        if not field_path:
            field_path = TypePath()
        else:
            assert isinstance(field_path, TypePath), field_path

        self._field_path = field_path
        self._dtype = structT
        assert self._dtype.fields, "Needs to have at least some mebers (othervise this interface is useless)"
        self._instantiateFieldFn = instantiateFieldFn
        self._fieldsToInterfaces = {}
Beispiel #6
0
    def asQuartusTcl(self, buff: List[str], version: str, component,
                     entity: Entity, allInterfaces: List[Interface],
                     thisIf: Interface):
        """
        Add interface to Quartus tcl

        :param buff: line buffer for output
        :param version: Quartus version
        :param intfName: name of top interface
        :param component: component object from ipcore generator
        :param entity: Entity instance of top unit
        :param allInterfaces: list of all interfaces of top unit
        :param thisIf: interface to add into Quartus TCL
        """
        name = getSignalName(thisIf)
        self.quartus_tcl_add_interface(buff, thisIf)
        clk = thisIf._getAssociatedClk()
        if clk is not None:
            self.quartus_prop(buff,
                              name,
                              "associatedClock",
                              clk._sigInside.name,
                              escapeStr=False)
        rst = thisIf._getAssociatedRst()
        if rst is not None:
            self.quartus_prop(buff,
                              name,
                              "associatedReset",
                              rst._sigInside.name,
                              escapeStr=False)

        m = self.get_quartus_map()
        if m:
            intfMapOrName = m
        else:
            intfMapOrName = thisIf.name
        self._asQuartusTcl(buff, version, name, component, entity,
                           allInterfaces, thisIf, intfMapOrName)
Beispiel #7
0
 def asQuartusTcl(self, buff: List[str], version: str, component: Component,
                  packager: IpPackager, thisIf: Interface):
     self.quartus_tcl_add_interface(buff, thisIf, packager)
     name = packager.getInterfacePhysicalName(thisIf)
     # self.quartus_prop("associatedClock", clock)
     self.quartus_prop(buff, name, "synchronousEdges", "DEASSERT")
     self.quartus_add_interface_port(buff, name, thisIf, "reset", packager)
     clk = thisIf._getAssociatedClk()
     if clk is not None:
         self.quartus_prop(buff,
                           name,
                           "associatedClock",
                           packager.getInterfacePhysicalName(clk),
                           escapeStr=False)
Beispiel #8
0
 def register(self,
              intf: Interface,
              name: Optional[str] = None,
              cdc: bool = False,
              trigger: Optional[RtlSignal] = None,
              add_reg: bool = False):
     """
     :param intf: an interface to monitor
     :param name: name override
     :param cdc: if True instantiate Clock domain crossing to synchronize input
         data to clock domain of this component
     :param trigger: an optional signal which triggers the snapshot of this interface
     :note: if cdc is set to True the trigger has to be synchonezed to a clock clock domain of intf
     :param add_reg: if True an register is added between input and bus interface
     """
     assert not self.io_instantiated
     if name is None:
         if isinstance(intf, InterfaceBase):
             name = intf._getPhysicalName()
         else:
             name = intf.name
     self.monitored_data.append((intf, name, cdc, trigger, add_reg))