File tree Expand file tree Collapse file tree 2 files changed +23
-13
lines changed
compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -616,6 +616,27 @@ abstract class ComponentCppWriterUtils(
616616 case Command .Param .Set => " set"
617617 }
618618
619+ /** Whether an invoker is required for a port instance */
620+ def invokerRequired (portInstance : PortInstance ) =
621+ portInstance.getSpecialKind match {
622+ case Some (Ast .SpecPortInstance .CommandReg ) |
623+ Some (Ast .SpecPortInstance .CommandResp ) =>
624+ hasCommands || hasParameters
625+ case Some (Ast .SpecPortInstance .Event ) |
626+ Some (Ast .SpecPortInstance .TextEvent ) =>
627+ hasEvents
628+ case Some (Ast .SpecPortInstance .ParamGet ) |
629+ Some (Ast .SpecPortInstance .ParamSet ) =>
630+ hasParameters
631+ case Some (Ast .SpecPortInstance .ProductGet ) |
632+ Some (Ast .SpecPortInstance .ProductRequest ) |
633+ Some (Ast .SpecPortInstance .ProductSend ) =>
634+ hasDataProducts
635+ case Some (Ast .SpecPortInstance .Telemetry ) =>
636+ hasTelemetry
637+ case _ => true
638+ }
639+
619640 /** Write a state machine identifier name */
620641 def writeSmIdName (name : String ) = s " SmId:: ${name}"
621642
Original file line number Diff line number Diff line change @@ -64,19 +64,8 @@ case class ComponentPorts(
6464 inputPortWriter.getCallbacks(typedInputPorts),
6565 inputPortWriter.getCallbacks(serialInputPorts),
6666 {
67- val ports = List .concat(
68- guardedList (hasDataProducts) (dataProductOutputPorts),
69- List (
70- guardedOption (hasCommands || hasParameters) (cmdRegPort),
71- guardedOption (hasCommands || hasParameters) (cmdRespPort),
72- guardedOption (hasEvents) (eventPort),
73- guardedOption (hasEvents) (textEventPort),
74- guardedOption (hasParameters) (prmGetPort),
75- guardedOption (hasParameters) (prmSetPort),
76- timeGetPort,
77- guardedOption (hasTelemetry) (tlmPort),
78- ).filter(_.isDefined).map(_.get)
79- ).sortBy(_.getUnqualifiedName)
67+ val ports = specialOutputPorts.filter(invokerRequired).
68+ sortBy(_.getUnqualifiedName)
8069 outputPortWriter.getInvokers(ports, " private" , Some (" special" ))
8170 }
8271 )
You can’t perform that action at this time.
0 commit comments