gds_software.c4.compile¶ Compiler: C4Model -> GDSSpec / SystemIR. Public Functions¶ Compile a C4Model into a GDSSpec. Source code in packages/gds-software/gds_software/c4/compile.py 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307def compile_c4(model: C4Model) -> GDSSpec: """Compile a C4Model into a GDSSpec.""" spec = GDSSpec(name=model.name, description=model.description) # 1. Register types spec.collect(C4RequestType, C4StateType) # 2. Register spaces spec.collect(C4RequestSpace, C4StateSpace) # 3. Register entities for stateful containers/components for c in model.containers: if c.stateful: spec.register_entity(_build_entity(c.name)) for c in model.components: if c.stateful: spec.register_entity(_build_entity(c.name)) # 4. Register blocks for p in model.persons: spec.register_block(_build_person_block(p)) for e in model.external_systems: spec.register_block(_build_external_system_block(e)) for c in model.containers: spec.register_block(_build_container_block(c, model)) for c in model.components: spec.register_block(_build_component_block(c, model)) # 5. Register spec wirings all_block_names = [b.name for b in spec.blocks.values()] wires: list[Wire] = [] for rel in model.relationships: wires.append( Wire(source=rel.source, target=rel.target, space="C4 RequestSpace") ) spec.register_wiring( SpecWiring( name=f"{model.name} Wiring", block_names=all_block_names, wires=wires, description=f"Auto-generated wiring for C4 model {model.name!r}", ) ) return spec Compile a C4Model directly to SystemIR. Source code in packages/gds-software/gds_software/c4/compile.py 310 311 312 313def compile_c4_to_system(model: C4Model) -> SystemIR: """Compile a C4Model directly to SystemIR.""" root = _build_composition_tree(model) return compile_system(model.name, root)