@@ -557,6 +557,9 @@ class Routing(BaseModel):
557557 port_id_bits : int = 1
558558 num_vc_id_bits : int = 0
559559 en_multicast : bool = False
560+ en_parallel_reduction : bool = False
561+ en_narrow_offload_reduction : bool = False
562+ en_wide_offload_reduction : bool = False
560563
561564 @field_validator ("route_algo" , mode = "before" )
562565 @classmethod
@@ -566,6 +569,28 @@ def validate_route_algo(cls, v):
566569 v = RouteAlgo [v ]
567570 return v
568571
572+ @model_validator (mode = "after" )
573+ def validate_collective (self ):
574+ """Reduction can be supported with multicast only."""
575+ if not self .en_multicast and (
576+ self .en_parallel_reduction or
577+ self .en_narrow_offload_reduction or
578+ self .en_wide_offload_reduction
579+ ):
580+ raise ValueError (
581+ "Multicast must be enabled to use any reduction feature "
582+ )
583+ return self
584+
585+ @model_validator (mode = "after" )
586+ def validate_multicast_route_algo (self ):
587+ """Multicast is supported with XY routing only"""
588+ if self .en_multicast and self .route_algo != RouteAlgo .XY :
589+ raise ValueError (
590+ "Multicast is only supported with XY routing algorithm, "
591+ f"but got { self .route_algo } "
592+ )
593+ return self
569594 def render_param_decl (self ) -> str :
570595 """Render the SystemVerilog parameter declaration."""
571596 string = ""
@@ -627,6 +652,14 @@ def render_hdr_typedef(self, network_type) -> str:
627652
628653 if self .num_vc_id_bits == 0 :
629654 if self .en_multicast :
655+ if ( self .en_parallel_reduction
656+ or self .en_narrow_offload_reduction
657+ or self .en_wide_offload_reduction
658+ ):
659+ return (
660+ f"`FLOO_TYPEDEF_HDR_T(hdr_t, { dst_type } , id_t, { ch_type } , rob_idx_t,"
661+ f"id_t, collect_comm_e, reduction_op_t)" )
662+
630663 return (
631664 f"`FLOO_TYPEDEF_HDR_T(hdr_t, { dst_type } , id_t, { ch_type } , rob_idx_t,"
632665 f"id_t, collect_comm_e)" )
@@ -645,6 +678,9 @@ def render_route_cfg(self, name) -> str:
645678 self .route_algo == RouteAlgo .ID and not self .use_id_table else 0 ,
646679 "NumSamRules" : len (self .sam ),
647680 "NumRoutes" : self .num_endpoints if self .route_algo == RouteAlgo .SRC else 0 ,
648- "EnMultiCast" : bool_to_sv (self .en_multicast )
681+ "EnMultiCast" : bool_to_sv (self .en_multicast ),
682+ "EnParallelReduction" : bool_to_sv (self .en_parallel_reduction ),
683+ "EnNarrowOffloadReduction" : bool_to_sv (self .en_narrow_offload_reduction ),
684+ "EnWideOffloadReduction" : bool_to_sv (self .en_wide_offload_reduction )
649685 }
650686 return sv_param_decl (name , sv_struct_render (fields ), dtype = "route_cfg_t" )
0 commit comments