@@ -24,7 +24,8 @@ object UcNetworkInterfaceFactory {
2424 UcCoapUdpIpInterface .fromAttribute(federate, attr)
2525 },
2626 Pair (CUSTOM ) { federate, attr -> UcCustomInterface .fromAttribute(federate, attr) },
27- Pair (UART ) { federate, attr -> UcUARTInterface .fromAttribute(federate, attr) })
27+ Pair (UART ) { federate, attr -> UcUARTInterface .fromAttribute(federate, attr) },
28+ Pair (S4NOC ) { federate, attr -> UcS4NocInterface .fromAttribute(federate, attr) })
2829
2930 fun createInterfaces (federate : UcFederate ): List <UcNetworkInterface > {
3031 val attrs: List <Attribute > = getInterfaceAttributes(federate.inst)
@@ -74,8 +75,7 @@ class UcUARTEndpoint(
7475class UcCoapUdpIpEndpoint (val ipAddress : IPAddress , iface : UcCoapUdpIpInterface ) :
7576 UcNetworkEndpoint (iface) {}
7677
77- class UcS4NocEndpoint (val s4nocId : Int , val port : Int , iface : UcS4NocInterface ) :
78- UcNetworkEndpoint (iface) {}
78+ class UcS4NocEndpoint (val core : Int , iface : UcS4NocInterface ) : UcNetworkEndpoint(iface) {}
7979
8080class UcCustomEndpoint (iface : UcCustomInterface ) : UcNetworkEndpoint(iface) {}
8181
@@ -200,23 +200,26 @@ class UcCoapUdpIpInterface(private val ipAddress: IPAddress, name: String? = nul
200200 }
201201}
202202
203- class UcS4NocInterface (val s4nocId : Int , val port : Int , name : String? = null ) :
203+ class UcS4NocInterface (val core : Int , name : String? = null ) :
204204 UcNetworkInterface (S4NOC , name ? : " s4noc" ) {
205205 override val includeHeaders: String = " "
206206 override val compileDefs: String = " NETWORK_CHANNEL_S4NOC"
207207
208+ init {
209+ println (" UcS4NocInterface created with core=$core and name=${name ? : " s4noc" } " )
210+ }
211+
208212 fun createEndpoint (): UcS4NocEndpoint {
209- val ep = UcS4NocEndpoint (s4nocId, port , this )
213+ val ep = UcS4NocEndpoint (core , this )
210214 endpoints.add(ep)
211215 return ep
212216 }
213217
214218 companion object {
215219 fun fromAttribute (federate : UcFederate , attr : Attribute ): UcS4NocInterface {
216- val s4nocId = attr.getParamInt(" s4noc_id" ) ? : 0
217- val port = attr.getParamInt(" port" ) ? : 0
220+ val core = attr.getParamInt(" core" ) ? : 0
218221 val name = attr.getParamString(" name" )
219- return UcS4NocInterface (s4nocId, port , name)
222+ return UcS4NocInterface (core , name)
220223 }
221224 }
222225}
@@ -401,10 +404,10 @@ class UcS4NocChannel(
401404 private val destS4Noc = dest
402405
403406 override fun generateChannelCtorSrc () =
404- " S4NocChannel_ctor(&self->channel, ${if (serverLhs) srcS4Noc.s4nocId else destS4Noc.s4nocId} , ${ if (serverLhs) srcS4Noc.port else destS4Noc.port } );"
407+ " S4NocChannel_ctor(&self->channel, ${if (serverLhs) srcS4Noc.core else destS4Noc.core } );"
405408
406409 override fun generateChannelCtorDest () =
407- " S4NocChannel_ctor(&self->channel, ${if (serverLhs) srcS4Noc.s4nocId else destS4Noc.s4nocId} , ${ if (serverLhs) srcS4Noc.port else destS4Noc.port } );"
410+ " S4NocChannel_ctor(&self->channel, ${if (serverLhs) srcS4Noc.core else destS4Noc.core } );"
408411
409412 override val codeType: String
410413 get() = " S4NocChannel"
0 commit comments