diff --git a/docs/source/config.md b/docs/source/config.md index 4c2682d1..82382b43 100644 --- a/docs/source/config.md +++ b/docs/source/config.md @@ -45,18 +45,16 @@ The configuration file for Topwrap provides the following options: - `repositories` - - Type: List of objects + - Type: Dictionary of `name: path` - Merging strategy: Merge - - Specifies repositories to load, with each repository defined as an object containing the following fields: - - `name`: (required) The name of the repository. - - `path`: (required) The file system path to the repository. + - Specifies repositories to load, with each repository defined as an entry in which: + - The key is the name of the repository. + - The value is the [resource path](description_files.md#resource-path-syntax) to the repository. - Example of specifying multiple repositories: ```yaml repositories: - - name: name_of_repo - path: path_to_repo - - name: another_repo - path: /absolute/path/to/repo + name_of_repo: file:path_to_repo + another_repo: file:/absolute/path/to/repo ``` Repositories are used to package and load multiple IP cores and custom interfaces. @@ -70,6 +68,5 @@ Here is a sample configuration file used in the [hierarchy example](examples.md# ```yaml force_interface_compliance: true repositories: - - name: Hierarchies example - path: ./repo/ + my_repo: file:./repo ``` diff --git a/examples/constant/Makefile b/examples/constant/Makefile index 65280dfb..6cc373b0 100644 --- a/examples/constant/Makefile +++ b/examples/constant/Makefile @@ -20,8 +20,8 @@ generate: copy_sources topwrap build --design ${DESIGN} --sources ${SOURCE_DIR} $(JSONS): - topwrap specification ipcores/* - topwrap dataflow -d project.yaml ipcores/* + topwrap specification -d project.yaml + topwrap dataflow -d project.yaml # ------------------------------------- # Utilities diff --git a/examples/constant/project.yaml b/examples/constant/project.yaml index 2c448385..2a78c74f 100644 --- a/examples/constant/project.yaml +++ b/examples/constant/project.yaml @@ -3,7 +3,7 @@ ips: ip_ibuf: - file: ipcores/ibuf.yaml + file: file:ipcores/ibuf.yaml design: name: project_top diff --git a/examples/getting_started_demo/Makefile b/examples/getting_started_demo/Makefile index e76dc05f..4f442643 100644 --- a/examples/getting_started_demo/Makefile +++ b/examples/getting_started_demo/Makefile @@ -12,7 +12,7 @@ SOURCE_FILES := \ all: $(JSONS) $(JSONS): parse - topwrap specification ${IPCORES_DIR}/*.yaml + topwrap specification -d project.yaml topwrap dataflow -d project.yaml ${IPCORES_DIR}/*.yaml parse: clean setup diff --git a/examples/getting_started_demo/project.yaml b/examples/getting_started_demo/project.yaml index 96c23fbc..dceab7bf 100644 --- a/examples/getting_started_demo/project.yaml +++ b/examples/getting_started_demo/project.yaml @@ -17,6 +17,6 @@ external: - Output_c ips: simple_core_1: - file: ipcores/simple_core_1.yaml + file: file:ipcores/simple_core_1.yaml simple_core_2: - file: ipcores/simple_core_2.yaml + file: file:ipcores/simple_core_2.yaml diff --git a/examples/hdmi/Makefile b/examples/hdmi/Makefile index 7aedbb01..52174303 100644 --- a/examples/hdmi/Makefile +++ b/examples/hdmi/Makefile @@ -41,7 +41,7 @@ deps: ci: deps generate $(JSONS): - topwrap specification ipcores/*.yaml ../../topwrap/ips/axi/*.yaml - topwrap dataflow -d project.yaml ipcores/*.yaml ../../topwrap/ips/axi/*.yaml + topwrap specification -d project.yaml + topwrap dataflow -d project.yaml .PHONY: clean copy_sources fusesoc_init generate copy_sources snickerdoodle zvb deps ci all diff --git a/examples/hdmi/project.yaml b/examples/hdmi/project.yaml index 32c0a4cb..2741a0bd 100644 --- a/examples/hdmi/project.yaml +++ b/examples/hdmi/project.yaml @@ -188,32 +188,32 @@ external: - HDMI_D2_N ips: axi_bridge_disp: - file: axi/axi_axil_adapter.yaml + file: &axil repo[builtin]:cores/axi_axil_adapter/core.yaml axi_bridge_dma: - file: axi/axi_axil_adapter.yaml + file: *axil axi_bridge_mmcm: - file: axi/axi_axil_adapter.yaml + file: *axil axi_interconnect0: - file: axi/axi_interconnect.yaml + file: repo[builtin]:cores/axi_interconnect/core.yaml axi_protocol_converter0: - file: axi/axi_protocol_converter.yaml + file: repo[builtin]:cores/axi_protocol_converter/core.yaml axis_clock_converter: - file: axi/axis_async_fifo.yaml + file: repo[builtin]:cores/axis_async_fifo/core.yaml axis_dwidth_converter: - file: axi/axis_dwidth_converter.yaml + file: repo[builtin]:cores/axis_dwidth_converter/core.yaml clock_crossing: - file: ipcores/clock_crossing.yaml + file: file:ipcores/clock_crossing.yaml disp: - file: ipcores/axi_dispctrl.yaml + file: file:ipcores/axi_dispctrl.yaml dma: - file: ipcores/dma_axi_in_axis_out.yaml + file: file:ipcores/dma_axi_in_axis_out.yaml hdmi: - file: ipcores/hdmi_tx.yaml + file: file:ipcores/hdmi_tx.yaml mmcm: - file: ipcores/litex_mmcm.yaml + file: file:ipcores/litex_mmcm.yaml ps7: - file: ipcores/ps7.yaml + file: file:ipcores/ps7.yaml reset0: - file: ipcores/proc_sys_reset.yaml + file: file:ipcores/proc_sys_reset.yaml reset1: - file: ipcores/proc_sys_reset.yaml + file: file:ipcores/proc_sys_reset.yaml diff --git a/examples/hierarchy/Makefile b/examples/hierarchy/Makefile index 511b31dc..1209e944 100644 --- a/examples/hierarchy/Makefile +++ b/examples/hierarchy/Makefile @@ -6,7 +6,7 @@ JSONS = kpm_spec.json kpm_dataflow.json all: $(JSONS) $(JSONS): - topwrap specification + topwrap specification -d project.yaml topwrap dataflow -d project.yaml clean: diff --git a/examples/hierarchy/project.yaml b/examples/hierarchy/project.yaml index 2eb56093..63b4eab9 100644 --- a/examples/hierarchy/project.yaml +++ b/examples/hierarchy/project.yaml @@ -30,11 +30,11 @@ design: - cs_s1_empty_out ips: s1_mod_1: - file: repo/cores/s1_mod_1/s1_mod_1.yaml + file: file:repo/cores/s1_mod_1/s1_mod_1.yaml s1_mod_2: - file: repo/cores/s1_mod_2/s1_mod_2.yaml + file: file:repo/cores/s1_mod_2/s1_mod_2.yaml s1_mod_3: - file: repo/cores/s1_mod_3/s1_mod_3.yaml + file: file:repo/cores/s1_mod_3/s1_mod_3.yaml sub_2: design: ports: @@ -54,9 +54,9 @@ design: - cs_s2_mod_out_1 ips: s2_mod_1: - file: repo/cores/s2_mod_1/s2_mod_1.yaml + file: file:repo/cores/s2_mod_1/s2_mod_1.yaml s2_mod_2: - file: repo/cores/s2_mod_2/s2_mod_2.yaml + file: file:repo/cores/s2_mod_2/s2_mod_2.yaml ports: sub_1: cs_s1_int_const_in: 1 @@ -96,11 +96,11 @@ design: - c_out_1 ips: c_mod_1: - file: repo/cores/c_mod_1/c_mod_1.yaml + file: file:repo/cores/c_mod_1/c_mod_1.yaml c_mod_2: - file: repo/cores/c_mod_2/c_mod_2.yaml + file: file:repo/cores/c_mod_2/c_mod_2.yaml c_mod_3: - file: repo/cores/c_mod_3/c_mod_3.yaml + file: file:repo/cores/c_mod_3/c_mod_3.yaml ports: complex_sub: cs_in_1: [counter, c_out_1] diff --git a/examples/hierarchy/topwrap.yaml b/examples/hierarchy/topwrap.yaml index 4a28b309..37bf6c21 100644 --- a/examples/hierarchy/topwrap.yaml +++ b/examples/hierarchy/topwrap.yaml @@ -1,4 +1,3 @@ force_interface_compliance: false repositories: - - name: Hierarchies example - path: ./repo/ + my_repo: file:./repo/ diff --git a/examples/inout/Makefile b/examples/inout/Makefile index 8fc78415..553ce094 100644 --- a/examples/inout/Makefile +++ b/examples/inout/Makefile @@ -66,7 +66,7 @@ deps: ci: deps generate $(JSONS): parse - topwrap specification ${IPCORES_DIR}/*.yaml - topwrap dataflow -d project.yaml ${IPCORES_DIR}/*.yaml + topwrap specification -d project.yaml + topwrap dataflow -d project.yaml .PHONY: setup clean fusesoc_init generate copy_sources bit parse deps ci all diff --git a/examples/inout/project.yaml b/examples/inout/project.yaml index fce9f521..80e8dc59 100644 --- a/examples/inout/project.yaml +++ b/examples/inout/project.yaml @@ -3,11 +3,11 @@ ips: ip_ibuf: - file: ipcores/ibuf.yaml + file: file:ipcores/ibuf.yaml ip_obuf: - file: ipcores/obuf.yaml + file: file:ipcores/obuf.yaml ip_iobuf: - file: ipcores/iobuf.yaml + file: file:ipcores/iobuf.yaml design: name: project_top diff --git a/examples/ir_examples/hierarchical/Makefile b/examples/ir_examples/hierarchical/Makefile index b3ddc7a7..0b3a075d 100644 --- a/examples/ir_examples/hierarchical/Makefile +++ b/examples/ir_examples/hierarchical/Makefile @@ -6,8 +6,8 @@ JSONS = kpm_spec.json kpm_dataflow.json all: $(JSONS) $(JSONS): - topwrap specification ips/*.yaml - topwrap dataflow -d design.yaml ips/*.yaml + topwrap specification + topwrap dataflow -d design.yaml clean: rm -f $(JSONS) diff --git a/examples/ir_examples/hierarchical/design.yaml b/examples/ir_examples/hierarchical/design.yaml index c1ebc0c2..5a527437 100644 --- a/examples/ir_examples/hierarchical/design.yaml +++ b/examples/ir_examples/hierarchical/design.yaml @@ -32,9 +32,9 @@ design: - sum ips: D-flipflop: - file: ips/d_ff.yaml + file: file:ips/d_ff.yaml adder: - file: ips/adder.yaml + file: file:ips/adder.yaml encoder: external: ports: @@ -77,7 +77,7 @@ design: - enc2 ips: debouncer: - file: ips/debouncer.yaml + file: file:ips/debouncer.yaml ports: proc: btn: btn diff --git a/examples/ir_examples/interconnect/Makefile b/examples/ir_examples/interconnect/Makefile index b3ddc7a7..0b3a075d 100644 --- a/examples/ir_examples/interconnect/Makefile +++ b/examples/ir_examples/interconnect/Makefile @@ -6,8 +6,8 @@ JSONS = kpm_spec.json kpm_dataflow.json all: $(JSONS) $(JSONS): - topwrap specification ips/*.yaml - topwrap dataflow -d design.yaml ips/*.yaml + topwrap specification + topwrap dataflow -d design.yaml clean: rm -f $(JSONS) diff --git a/examples/ir_examples/interconnect/design.yaml b/examples/ir_examples/interconnect/design.yaml index 8b41b121..72df6a5d 100644 --- a/examples/ir_examples/interconnect/design.yaml +++ b/examples/ir_examples/interconnect/design.yaml @@ -9,13 +9,13 @@ external: ips: cpu: - file: ips/cpu.yaml + file: file:ips/cpu.yaml wb_pass: - file: ips/wb_passthrough.yaml + file: file:ips/wb_passthrough.yaml mem: - file: ips/mem.yaml + file: file:ips/mem.yaml dsp: - file: ips/dsp.yaml + file: file:ips/dsp.yaml design: ports: diff --git a/examples/ir_examples/interface/Makefile b/examples/ir_examples/interface/Makefile index b3ddc7a7..0b3a075d 100644 --- a/examples/ir_examples/interface/Makefile +++ b/examples/ir_examples/interface/Makefile @@ -6,8 +6,8 @@ JSONS = kpm_spec.json kpm_dataflow.json all: $(JSONS) $(JSONS): - topwrap specification ips/*.yaml - topwrap dataflow -d design.yaml ips/*.yaml + topwrap specification + topwrap dataflow -d design.yaml clean: rm -f $(JSONS) diff --git a/examples/ir_examples/interface/design.yaml b/examples/ir_examples/interface/design.yaml index be6d6b7a..cc7b892c 100644 --- a/examples/ir_examples/interface/design.yaml +++ b/examples/ir_examples/interface/design.yaml @@ -21,6 +21,6 @@ external: ips: streamer: - file: ips/streamer.yaml + file: file:ips/streamer.yaml receiver: - file: ips/receiver.yaml + file: file:ips/receiver.yaml diff --git a/examples/ir_examples/simple/Makefile b/examples/ir_examples/simple/Makefile index b3ddc7a7..0b3a075d 100644 --- a/examples/ir_examples/simple/Makefile +++ b/examples/ir_examples/simple/Makefile @@ -6,8 +6,8 @@ JSONS = kpm_spec.json kpm_dataflow.json all: $(JSONS) $(JSONS): - topwrap specification ips/*.yaml - topwrap dataflow -d design.yaml ips/*.yaml + topwrap specification + topwrap dataflow -d design.yaml clean: rm -f $(JSONS) diff --git a/examples/ir_examples/simple/design.yaml b/examples/ir_examples/simple/design.yaml index 80f7d218..f554981d 100644 --- a/examples/ir_examples/simple/design.yaml +++ b/examples/ir_examples/simple/design.yaml @@ -9,11 +9,11 @@ external: ips: 2mux: - file: ips/2mux.yaml + file: file:ips/2mux.yaml gen1: - file: ips/lfsr_gen.yaml + file: file:ips/lfsr_gen.yaml gen2: - file: ips/lfsr_gen.yaml + file: file:ips/lfsr_gen.yaml design: parameters: diff --git a/examples/pwm/Makefile b/examples/pwm/Makefile index ac12674c..40d681aa 100644 --- a/examples/pwm/Makefile +++ b/examples/pwm/Makefile @@ -39,7 +39,7 @@ deps: ci: deps generate $(JSONS): - topwrap specification ipcores/*.yaml ../../topwrap/ips/axi/*.yaml - topwrap dataflow -d project.yaml ipcores/*.yaml ../../topwrap/ips/axi/*.yaml + topwrap specification -d project.yaml + topwrap dataflow -d project.yaml .PHONY: clean copy_sources fusesoc_init generate zvb deps ci all diff --git a/examples/pwm/project.yaml b/examples/pwm/project.yaml index 5fd20a1f..44ecd030 100644 --- a/examples/pwm/project.yaml +++ b/examples/pwm/project.yaml @@ -28,8 +28,8 @@ external: - pwm ips: axi_bridge: - file: axi/axi_axil_adapter.yaml + file: repo[builtin]:cores/axi_axil_adapter/core.yaml litex_pwm_top: - file: ipcores/litex_pwm.yaml + file: file:ipcores/litex_pwm.yaml ps7: - file: ipcores/ps7.yaml + file: file:ipcores/ps7.yaml diff --git a/examples/soc/Makefile b/examples/soc/Makefile index 3f2fe6ab..c09b00eb 100644 --- a/examples/soc/Makefile +++ b/examples/soc/Makefile @@ -32,8 +32,8 @@ build/simple_soc.bit: build/bios.init simple_soc.tcl $(IPCORE_SOURCES) build/sim vivado -mode batch -source simple_soc.tcl $(JSONS): $(IPCORE_YAMLS) - topwrap specification $(IPCORE_YAMLS) - topwrap dataflow -d project.yaml $(IPCORE_YAMLS) + topwrap specification -d project.yaml + topwrap dataflow -d project.yaml generate: build/simple_soc.v diff --git a/examples/soc/project.yaml b/examples/soc/project.yaml index 9007d4c0..7b34094a 100644 --- a/examples/soc/project.yaml +++ b/examples/soc/project.yaml @@ -3,17 +3,17 @@ ips: vexriscv: - file: ipcores/VexRiscv.yaml + file: file:ipcores/VexRiscv.yaml wb_ram_data: - file: ipcores/mem.yaml + file: file:ipcores/mem.yaml wb_ram_instr: - file: ipcores/mem.yaml + file: file:ipcores/mem.yaml crg: - file: ipcores/crg.yaml + file: file:ipcores/crg.yaml wb_uart: - file: ipcores/wb_uart.yaml + file: file:ipcores/wb_uart.yaml interconnect: - file: ipcores/wb_interconnect.yaml + file: file:ipcores/wb_interconnect.yaml design: name: simple_soc diff --git a/examples/user_repository/Makefile b/examples/user_repository/Makefile index 511b31dc..1209e944 100644 --- a/examples/user_repository/Makefile +++ b/examples/user_repository/Makefile @@ -6,7 +6,7 @@ JSONS = kpm_spec.json kpm_dataflow.json all: $(JSONS) $(JSONS): - topwrap specification + topwrap specification -d project.yaml topwrap dataflow -d project.yaml clean: diff --git a/examples/user_repository/project.yaml b/examples/user_repository/project.yaml index 61a096c3..ce9167c1 100644 --- a/examples/user_repository/project.yaml +++ b/examples/user_repository/project.yaml @@ -20,6 +20,6 @@ external: - ex_out_1 ips: core1: - file: repo/cores/example_core1/core1.yaml + file: repo[my_repo]:cores/example_core1/core1.yaml core2: - file: repo/cores/example_core2/core2.yaml + file: repo[my_repo]:cores/example_core2/core2.yaml diff --git a/examples/user_repository/topwrap.yaml b/examples/user_repository/topwrap.yaml index d1c0b22e..37bf6c21 100644 --- a/examples/user_repository/topwrap.yaml +++ b/examples/user_repository/topwrap.yaml @@ -1,4 +1,3 @@ force_interface_compliance: false repositories: - - name: Test loading config - path: ./repo/ + my_repo: file:./repo/ diff --git a/pyproject.toml b/pyproject.toml index 33a0a866..45bd669c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,9 +75,8 @@ include = ["topwrap*"] [tool.setuptools.package-data] topwrap = [ - "interfaces/*", - "ips/**/*", - "templates/*" + "templates/*", + "builtin/**/*" ] [tool.black] diff --git a/tests/data/data_build/clog2/clog2_design.yaml b/tests/data/data_build/clog2/clog2_design.yaml index 82628170..ba068a04 100644 --- a/tests/data/data_build/clog2/clog2_design.yaml +++ b/tests/data/data_build/clog2/clog2_design.yaml @@ -3,7 +3,7 @@ ips: core1: - file: clog2_tester.yaml + file: file:clog2_tester.yaml design: name: top ports: diff --git a/tests/data/data_build/clog2/clog2_design2.yaml b/tests/data/data_build/clog2/clog2_design2.yaml index 51e5f4b3..6c914eb9 100644 --- a/tests/data/data_build/clog2/clog2_design2.yaml +++ b/tests/data/data_build/clog2/clog2_design2.yaml @@ -3,7 +3,7 @@ ips: core1: - file: clog2_tester2.yaml + file: file:clog2_tester2.yaml design: name: top ports: diff --git a/tests/data/data_build/design.yaml b/tests/data/data_build/design.yaml index 3bd48a6a..f8593206 100644 --- a/tests/data/data_build/design.yaml +++ b/tests/data/data_build/design.yaml @@ -3,9 +3,9 @@ ips: dma: - file: DMATop.yaml + file: file:DMATop.yaml disp: - file: axi_dispctrl_v1_0.yaml + file: file:axi_dispctrl_v1_0.yaml design: ports: diff --git a/tests/data/data_build/hierarchy/design.yaml b/tests/data/data_build/hierarchy/design.yaml index 864bec63..3c469dcc 100644 --- a/tests/data/data_build/hierarchy/design.yaml +++ b/tests/data/data_build/hierarchy/design.yaml @@ -3,7 +3,7 @@ ips: pwm: - file: pwm.yaml + file: file:pwm.yaml # This design contains `pwm` module connected with `counter_hier` # which is a hierarchy containing a single `counter` module @@ -16,7 +16,7 @@ design: counter_hier: ips: counter: - file: counter.yaml + file: file:counter.yaml design: parameters: counter: diff --git a/tests/data/data_build/interconnect/project.yaml b/tests/data/data_build/interconnect/project.yaml index 23a89f39..fe8939ab 100644 --- a/tests/data/data_build/interconnect/project.yaml +++ b/tests/data/data_build/interconnect/project.yaml @@ -3,13 +3,13 @@ ips: soc: - file: ipcores/soc.yaml + file: file:ipcores/soc.yaml wb_ram_data: - file: ipcores/litex_mem.yaml + file: file:ipcores/litex_mem.yaml wb_ram_instr: - file: ipcores/litex_mem.yaml + file: file:ipcores/litex_mem.yaml crg: - file: ipcores/crg.yaml + file: file:ipcores/crg.yaml design: name: top diff --git a/tests/data/data_kpm/conversions/complex/project_complex.yaml b/tests/data/data_kpm/conversions/complex/project_complex.yaml index b88c2346..3a3f0fc9 100644 --- a/tests/data/data_kpm/conversions/complex/project_complex.yaml +++ b/tests/data/data_kpm/conversions/complex/project_complex.yaml @@ -15,7 +15,7 @@ design: - exposed ips: c_mod_2: - file: examples/hierarchy/repo/cores/c_mod_2/c_mod_2.yaml + file: file:../../../../../examples/hierarchy/repo/cores/c_mod_2/c_mod_2.yaml SUB: design: parameters: @@ -38,13 +38,13 @@ design: - cs_s2_f_int_in_2 ips: s1_mod_3: - file: examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml s1_mod_3_2: - file: examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml s2_mod_1: - file: examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml s2_mod_1_2: - file: examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml SUBEMPTY: design: hierarchies: @@ -64,9 +64,9 @@ design: - legacy_external_type ips: s1_mod_2: - file: examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml s1_mod_2_2: - file: examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml parameters: s1_mod_3: SUB_VALUE: 12 @@ -97,12 +97,12 @@ external: - cout ips: s1_mod_3: - file: examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml s1_mod_3_2: - file: examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml s1_mod_3_3: - file: examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml s2_mod_1: - file: examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml s2_mod_2: - file: examples/hierarchy/repo/cores/s2_mod_2/s2_mod_2.yaml + file: file:../../../../../examples/hierarchy/repo/cores/s2_mod_2/s2_mod_2.yaml diff --git a/tests/data/data_kpm/conversions/complex/specification_complex.json b/tests/data/data_kpm/conversions/complex/specification_complex.json index d90b6302..a9bce346 100644 --- a/tests/data/data_kpm/conversions/complex/specification_complex.json +++ b/tests/data/data_kpm/conversions/complex/specification_complex.json @@ -13,9 +13,9 @@ }, "layers": [ { - "name": "IP Cores", + "name": "Constants", "nodeLayers": [ - "IP Cores" + "Constants" ] }, { @@ -25,9 +25,9 @@ ] }, { - "name": "Constants", + "name": "IP Cores", "nodeLayers": [ - "Constants" + "IP Cores" ] } ], @@ -61,111 +61,129 @@ "nodes": [ { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/c_mod_1/c_mod_1.yaml", - "category": "IPcore", + "category": "Metanode", "interfaces": [ { "direction": "output", "maxConnectionsCount": -1, - "name": "c_int_out_1", - "type": [ - "port" - ] - }, - { - "direction": "input", - "maxConnectionsCount": -1, - "name": "c_mod_in_1", + "name": "constant", "type": [ "port" ] } ], - "layer": "IP Cores", - "name": "c_mod_1", + "layer": "Constants", + "name": "Constant", "properties": [ { - "default": "32", - "name": "MAX_VALUE", + "default": "0", + "name": "Constant Value", "type": "text" } ] }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/c_mod_2/c_mod_2.yaml", - "category": "IPcore", + "category": "Metanode", "interfaces": [ { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "c_mod_in_2", + "name": "external", "type": [ "port" ] - }, + } + ], + "layer": "Externals", + "name": "External Inout", + "properties": [ + { + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ { "direction": "output", "maxConnectionsCount": -1, - "name": "c_int_out_2", + "name": "external", "type": [ "port" ] } ], - "layer": "IP Cores", - "name": "c_mod_2" + "layer": "Externals", + "name": "External Input", + "properties": [ + { + "default": "", + "name": "External Name", + "type": "text" + } + ] }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/c_mod_3/c_mod_3.yaml", - "category": "IPcore", + "category": "Metanode", "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "c_int_const_in", + "name": "external", "type": [ "port" ] - }, + } + ], + "layer": "Externals", + "name": "External Output", + "properties": [ { - "direction": "output", - "maxConnectionsCount": -1, - "name": "c_mod_out_1", - "type": [ - "port" - ] - }, + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "c_int_in_2", + "name": "subgraph in", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "c_int_in_1", + "name": "subgraph out", "type": [ "port" ] } ], - "layer": "IP Cores", - "name": "c_mod_3" + "layer": "Externals", + "name": "Subgraph port" }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s1_mod_1/s1_mod_1.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/c_mod_2/c_mod_2.yaml", "category": "IPcore", "interfaces": [ { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "cs_s1_f_ext_const_in", + "name": "c_int_out_2", "type": [ "port" ] @@ -173,26 +191,18 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "cs_s1_f_mod_in_1", - "type": [ - "port" - ] - }, - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "cs_s1_mint_out_1", + "name": "c_mod_in_2", "type": [ "port" ] } ], "layer": "IP Cores", - "name": "s1_mod_1" + "name": "c_mod_2" }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml", "category": "IPcore", "interfaces": [ { @@ -217,7 +227,7 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml", "category": "IPcore", "interfaces": [ { @@ -249,13 +259,13 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml", "category": "IPcore", "interfaces": [ { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "cs_s2_mint_out_1", + "name": "cs_s2_f_int_in_1", "type": [ "port" ] @@ -263,15 +273,15 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "cs_s2_f_int_in_1", + "name": "cs_s2_f_int_in_2", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "cs_s2_f_int_in_2", + "name": "cs_s2_mint_out_1", "type": [ "port" ] @@ -290,7 +300,7 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s2_mod_2/s2_mod_2.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s2_mod_2/s2_mod_2.yaml", "category": "IPcore", "interfaces": [ { @@ -320,122 +330,6 @@ ], "layer": "IP Cores", "name": "s2_mod_2" - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "input", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port" - ] - } - ], - "layer": "Externals", - "name": "External Output", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port" - ] - } - ], - "layer": "Externals", - "name": "External Input", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "inout", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port" - ] - } - ], - "layer": "Externals", - "name": "External Inout", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "constant", - "type": [ - "port" - ] - } - ], - "layer": "Constants", - "name": "Constant", - "properties": [ - { - "default": "0", - "name": "Constant Value", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "subgraph out", - "type": [ - "port" - ] - }, - { - "direction": "input", - "maxConnectionsCount": -1, - "name": "subgraph in", - "type": [ - "port" - ] - } - ], - "layer": "Externals", - "name": "Subgraph port" } ] } diff --git a/tests/data/data_kpm/examples/hdmi/project_hdmi.yaml b/tests/data/data_kpm/examples/hdmi/project_hdmi.yaml deleted file mode 100644 index 010ffda7..00000000 --- a/tests/data/data_kpm/examples/hdmi/project_hdmi.yaml +++ /dev/null @@ -1,219 +0,0 @@ -design: - interfaces: - axi_bridge_disp: - s_axi: [axi_interconnect0, m_axi_2] - axi_bridge_dma: - s_axi: [axi_interconnect0, m_axi_1] - axi_bridge_mmcm: - s_axi: [axi_interconnect0, m_axi_0] - axi_interconnect0: - s_axi_0: [ps7, M_AXI_GP0] - axi_protocol_converter0: - S_AXI: [dma, m_axi] - axis_clock_converter: - s_axis: [dma, m_axis] - axis_dwidth_converter: - s_axis: [axis_clock_converter, m_axis] - disp: - S00_AXI: [axi_bridge_disp, m_axi] - S_AXIS: [axis_dwidth_converter, m_axis] - dma: - s_axi: [axi_bridge_dma, m_axi] - mmcm: - axi: [axi_bridge_mmcm, m_axi] - ps7: - S_AXI_HP0: [axi_protocol_converter0, M_AXI] - parameters: - axi_bridge_disp: - ADDR_WIDTH: 32 - AXIL_DATA_WIDTH: 32 - AXIL_STRB_WIDTH: AXIL_DATA_WIDTH/8 - AXI_DATA_WIDTH: 32 - AXI_ID_WIDTH: 12 - AXI_STRB_WIDTH: AXI_DATA_WIDTH/8 - axi_bridge_dma: - ADDR_WIDTH: 32 - AXIL_DATA_WIDTH: 32 - AXIL_STRB_WIDTH: AXIL_DATA_WIDTH/8 - AXI_DATA_WIDTH: 32 - AXI_ID_WIDTH: 12 - AXI_STRB_WIDTH: AXI_DATA_WIDTH/8 - axi_bridge_mmcm: - ADDR_WIDTH: 32 - AXIL_DATA_WIDTH: 32 - AXIL_STRB_WIDTH: AXIL_DATA_WIDTH/8 - AXI_DATA_WIDTH: 32 - AXI_ID_WIDTH: 12 - AXI_STRB_WIDTH: AXI_DATA_WIDTH/8 - axi_interconnect0: - ADDR_WIDTH: 32 - ARUSER_WIDTH: 1 - AWUSER_WIDTH: 1 - BUSER_WIDTH: 1 - DATA_WIDTH: 32 - ID_WIDTH: 12 - M_ADDR_WIDTH: - value: 295147905248072302608 - width: 96 - M_BASE_ADDR: - value: 20970027271917541136636313600 - width: 118 - M_COUNT: 3 - RUSER_WIDTH: 1 - STRB_WIDTH: DATA_WIDTH/8 - S_COUNT: 1 - WUSER_WIDTH: 1 - axis_clock_converter: - DATA_WIDTH: 64 - DEST_WIDTH: 8 - ID_ENABLE: 0 - ID_WIDTH: 8 - KEEP_WIDTH: (DATA_WIDTH+7)/8 - USER_ENABLE: 0 - USER_WIDTH: 1 - axis_dwidth_converter: - IN_DATA_WIDTH: 64 - OUT_DATA_WIDTH: 32 - ports: - axi_bridge_disp: - clk: [ps7, FCLK0] - rst: [reset0, bus_struct_reset] - axi_bridge_dma: - clk: [ps7, FCLK0] - rst: [reset0, bus_struct_reset] - axi_bridge_mmcm: - clk: [ps7, FCLK0] - rst: [reset0, bus_struct_reset] - axi_interconnect0: - clk: [ps7, FCLK0] - rst: [reset0, bus_struct_reset] - axi_protocol_converter0: - aclk: [ps7, FCLK0] - aresetn: [reset0, interconnect_aresetn] - axis_clock_converter: - async_rst: [reset0, bus_struct_reset] - m_clk: [mmcm, clkgen_out0] - s_clk: [ps7, FCLK0] - axis_dwidth_converter: - aclk: [mmcm, clkgen_out0] - aresetn: [reset1, interconnect_aresetn] - clock_crossing: - A: [disp, FSYNC_O] - clkA: [mmcm, clkgen_out0] - clkB: [ps7, FCLK0] - disp: - LOCKED_I: [mmcm, clkgen_locked] - S_AXIS_ACLK: [mmcm, clkgen_out0] - s00_axi_aclk: [ps7, FCLK0] - s00_axi_aresetn: [reset0, peripheral_aresetn] - dma: - clock: [ps7, FCLK0] - io_sync_readerSync: [clock_crossing, B] - io_sync_writerSync: [clock_crossing, B] - reset: [reset0, peripheral_reset] - hdmi: - CTL: [disp, CTL_O] - DATA_I: [disp, DATA_O] - DGUARD: [disp, DGUARD_O] - DIEN: [disp, DIEN_O] - DIH: [disp, DIH_O] - HDMI_CLK_N: HDMI_CLK_N - HDMI_CLK_P: HDMI_CLK_P - HDMI_D0_N: HDMI_D0_N - HDMI_D0_P: HDMI_D0_P - HDMI_D1_N: HDMI_D1_N - HDMI_D1_P: HDMI_D1_P - HDMI_D2_N: HDMI_D2_N - HDMI_D2_P: HDMI_D2_P - LOCKED_I: [mmcm, clkgen_locked] - PXLCLK_5X_I: [mmcm, clkgen_out1] - PXLCLK_I: [mmcm, clkgen_out0] - VGA_DE: [disp, DE_O] - VGA_HS: [disp, HSYNC_O] - VGA_VS: [disp, VSYNC_O] - VGUARD: [disp, VGUARD_O] - mmcm: - clkgen_ref: [ps7, FCLK1] - sys_clk: [ps7, FCLK0] - sys_rst: [reset0, peripheral_reset] - ps7: - IRQ_F2P_0: [dma, io_irq_readerDone] - IRQ_F2P_1: [dma, io_irq_writerDone] - MAXIGP0ACLK: [ps7, FCLK0] - SAXIHP0ACLK: [ps7, FCLK0] - reset0: - aux_reset_in: 0 - dcm_locked: 1 - ext_reset_in: 0 - mb_debug_sys_rst: 0 - slowest_sync_clk: [ps7, FCLK0] - reset1: - aux_reset_in: 0 - dcm_locked: 1 - ext_reset_in: 0 - mb_debug_sys_rst: 0 - slowest_sync_clk: [mmcm, clkgen_out0] -external: - ports: - inout: - - [ps7, ddr_addr] - - [ps7, ddr_bankaddr] - - [ps7, ddr_cas_n] - - [ps7, ddr_cke] - - [ps7, ddr_clk] - - [ps7, ddr_clk_n] - - [ps7, ddr_cs_n] - - [ps7, ddr_dm] - - [ps7, ddr_dq] - - [ps7, ddr_dqs] - - [ps7, ddr_dqs_n] - - [ps7, ddr_drstb] - - [ps7, ddr_odt] - - [ps7, ddr_ras_n] - - [ps7, ddr_vr_n] - - [ps7, ddr_vr] - - [ps7, ddr_web] - - [ps7, ps_mio] - - [ps7, ps_clk] - - [ps7, ps_porb] - - [ps7, ps_srstb] - out: - - HDMI_CLK_N - - HDMI_CLK_P - - HDMI_D0_N - - HDMI_D0_P - - HDMI_D1_N - - HDMI_D1_P - - HDMI_D2_N - - HDMI_D2_P -ips: - axi_bridge_disp: - file: topwrap/ips/axi/axi_axil_adapter.yaml - axi_bridge_dma: - file: topwrap/ips/axi/axi_axil_adapter.yaml - axi_bridge_mmcm: - file: topwrap/ips/axi/axi_axil_adapter.yaml - axi_interconnect0: - file: topwrap/ips/axi/axi_interconnect.yaml - axi_protocol_converter0: - file: topwrap/ips/axi/axi_protocol_converter.yaml - axis_clock_converter: - file: topwrap/ips/axi/axis_async_fifo.yaml - axis_dwidth_converter: - file: topwrap/ips/axi/axis_dwidth_converter.yaml - clock_crossing: - file: examples/hdmi/ipcores/clock_crossing.yaml - disp: - file: examples/hdmi/ipcores/axi_dispctrl.yaml - dma: - file: examples/hdmi/ipcores/dma_axi_in_axis_out.yaml - hdmi: - file: examples/hdmi/ipcores/hdmi_tx.yaml - mmcm: - file: examples/hdmi/ipcores/litex_mmcm.yaml - ps7: - file: examples/hdmi/ipcores/ps7.yaml - reset0: - file: examples/hdmi/ipcores/proc_sys_reset.yaml - reset1: - file: examples/hdmi/ipcores/proc_sys_reset.yaml diff --git a/tests/data/data_kpm/examples/hdmi/specification_hdmi.json b/tests/data/data_kpm/examples/hdmi/specification_hdmi.json index 6d3e2daf..229adc4e 100644 --- a/tests/data/data_kpm/examples/hdmi/specification_hdmi.json +++ b/tests/data/data_kpm/examples/hdmi/specification_hdmi.json @@ -33,9 +33,9 @@ }, "layers": [ { - "name": "IP Cores", + "name": "Constants", "nodeLayers": [ - "IP Cores" + "Constants" ] }, { @@ -45,9 +45,9 @@ ] }, { - "name": "Constants", + "name": "IP Cores", "nodeLayers": [ - "Constants" + "IP Cores" ] } ], @@ -81,29 +81,120 @@ "nodes": [ { "abstract": false, - "additionalData": "examples/hdmi/ipcores/axi_dispctrl.yaml", - "category": "IPcore", + "category": "Metanode", "interfaces": [ { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "s00_axi_aclk", + "name": "constant", "type": [ + "iface_AXI3", + "iface_AXI4", + "iface_AXI4Lite", + "iface_AXI4Stream", "port" ] - }, + } + ], + "layer": "Constants", + "name": "Constant", + "properties": [ + { + "default": "0", + "name": "Constant Value", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ + { + "direction": "inout", + "maxConnectionsCount": -1, + "name": "external", + "type": [ + "iface_AXI3", + "iface_AXI4", + "iface_AXI4Lite", + "iface_AXI4Stream", + "port" + ] + } + ], + "layer": "Externals", + "name": "External Inout", + "properties": [ + { + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ { "direction": "output", "maxConnectionsCount": -1, - "name": "DGUARD_O", + "name": "external", + "type": [ + "iface_AXI3", + "iface_AXI4", + "iface_AXI4Lite", + "iface_AXI4Stream", + "port" + ] + } + ], + "layer": "Externals", + "name": "External Input", + "properties": [ + { + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "external", "type": [ + "iface_AXI3", + "iface_AXI4", + "iface_AXI4Lite", + "iface_AXI4Stream", "port" ] - }, + } + ], + "layer": "Externals", + "name": "External Output", + "properties": [ + { + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "S_AXIS_ACLK", + "name": "subgraph in", "type": [ "port" ] @@ -111,7 +202,24 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "DATA_O", + "name": "subgraph out", + "type": [ + "port" + ] + } + ], + "layer": "Externals", + "name": "Subgraph port" + }, + { + "abstract": false, + "additionalData": "repo[builtin]:cores/axi_axil_adapter/core.yaml", + "category": "IPcore", + "interfaces": [ + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "clk", "type": [ "port" ] @@ -119,15 +227,72 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "DIEN_O", + "name": "m_axi", + "type": [ + "iface_AXI4Lite" + ] + }, + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "rst", "type": [ "port" ] }, + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "s_axi", + "type": [ + "iface_AXI4" + ] + } + ], + "layer": "IP Cores", + "name": "axi_axil_adapter", + "properties": [ + { + "default": "32", + "name": "ADDR_WIDTH", + "type": "text" + }, + { + "default": "32", + "name": "AXIL_DATA_WIDTH", + "type": "text" + }, + { + "default": "AXIL_DATA_WIDTH/8", + "name": "AXIL_STRB_WIDTH", + "type": "text" + }, + { + "default": "32", + "name": "AXI_DATA_WIDTH", + "type": "text" + }, + { + "default": "8", + "name": "AXI_ID_WIDTH", + "type": "text" + }, + { + "default": "AXI_DATA_WIDTH/8", + "name": "AXI_STRB_WIDTH", + "type": "text" + } + ] + }, + { + "abstract": false, + "additionalData": "file:examples/hdmi/ipcores/axi_dispctrl.yaml", + "category": "IPcore", + "interfaces": [ { "direction": "output", "maxConnectionsCount": -1, - "name": "DE_O", + "name": "CTL_O", "type": [ "port" ] @@ -135,7 +300,7 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "VGUARD_O", + "name": "DATA_O", "type": [ "port" ] @@ -143,7 +308,7 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "HSYNC_O", + "name": "DE_O", "type": [ "port" ] @@ -151,7 +316,7 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "VSYNC_O", + "name": "DGUARD_O", "type": [ "port" ] @@ -159,7 +324,7 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "DIH_O", + "name": "DIEN_O", "type": [ "port" ] @@ -167,15 +332,15 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "CTL_O", + "name": "DIH_O", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "LOCKED_I", + "name": "FSYNC_O", "type": [ "port" ] @@ -183,7 +348,7 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "FSYNC_O", + "name": "HSYNC_O", "type": [ "port" ] @@ -191,7 +356,7 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "s00_axi_aresetn", + "name": "LOCKED_I", "type": [ "port" ] @@ -211,28 +376,27 @@ "type": [ "iface_AXI4Stream" ] - } - ], - "layer": "IP Cores", - "name": "axi_dispctrl" - }, - { - "abstract": false, - "additionalData": "examples/hdmi/ipcores/clock_crossing.yaml", - "category": "IPcore", - "interfaces": [ + }, { "direction": "input", "maxConnectionsCount": -1, - "name": "A", + "name": "S_AXIS_ACLK", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "clkB", + "name": "VGUARD_O", + "type": [ + "port" + ] + }, + { + "direction": "output", + "maxConnectionsCount": -1, + "name": "VSYNC_O", "type": [ "port" ] @@ -240,32 +404,32 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "clkA", + "name": "s00_axi_aclk", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "B", + "name": "s00_axi_aresetn", "type": [ "port" ] } ], "layer": "IP Cores", - "name": "clock_crossing" + "name": "axi_dispctrl" }, { "abstract": false, - "additionalData": "examples/hdmi/ipcores/dma_axi_in_axis_out.yaml", + "additionalData": "repo[builtin]:cores/axi_interconnect/core.yaml", "category": "IPcore", "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "io_sync_readerSync", + "name": "clk", "type": [ "port" ] @@ -273,31 +437,31 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "io_irq_writerDone", + "name": "m_axi_0", "type": [ - "port" + "iface_AXI4" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "io_sync_writerSync", + "name": "m_axi_1", "type": [ - "port" + "iface_AXI4" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "clock", + "name": "m_axi_2", "type": [ - "port" + "iface_AXI4" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "io_irq_readerDone", + "name": "rst", "type": [ "port" ] @@ -305,48 +469,132 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "reset", + "name": "s_axi_0", "type": [ - "port" + "iface_AXI4" ] + } + ], + "layer": "IP Cores", + "name": "axi_interconnect", + "properties": [ + { + "default": "32", + "name": "ADDR_WIDTH", + "type": "text" + }, + { + "default": "1", + "name": "ARUSER_WIDTH", + "type": "text" + }, + { + "default": "1", + "name": "AWUSER_WIDTH", + "type": "text" + }, + { + "default": "1", + "name": "BUSER_WIDTH", + "type": "text" + }, + { + "default": "32", + "name": "DATA_WIDTH", + "type": "text" + }, + { + "default": "12", + "name": "ID_WIDTH", + "type": "text" + }, + { + "default": "96'h100000001000000010", + "name": "M_ADDR_WIDTH", + "type": "text" + }, + { + "default": "0", + "name": "M_BASE_ADDR", + "type": "text" + }, + { + "default": "4", + "name": "M_COUNT", + "type": "text" + }, + { + "default": "1", + "name": "RUSER_WIDTH", + "type": "text" + }, + { + "default": "DATA_WIDTH/8", + "name": "STRB_WIDTH", + "type": "text" + }, + { + "default": "1", + "name": "S_COUNT", + "type": "text" }, + { + "default": "1", + "name": "WUSER_WIDTH", + "type": "text" + } + ] + }, + { + "abstract": false, + "additionalData": "repo[builtin]:cores/axi_protocol_converter/core.yaml", + "category": "IPcore", + "interfaces": [ { "direction": "output", "maxConnectionsCount": -1, - "name": "m_axis", + "name": "M_AXI", "type": [ - "iface_AXI4Stream" + "iface_AXI3" ] }, { "direction": "input", "maxConnectionsCount": -1, - "name": "s_axi", + "name": "S_AXI", "type": [ - "iface_AXI4Lite" + "iface_AXI4" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "m_axi", + "name": "aclk", "type": [ - "iface_AXI4" + "port" + ] + }, + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "aresetn", + "type": [ + "port" ] } ], "layer": "IP Cores", - "name": "dma_axi_in_axis_out" + "name": "axi_protocol_converter" }, { "abstract": false, - "additionalData": "examples/hdmi/ipcores/hdmi_tx.yaml", + "additionalData": "repo[builtin]:cores/axis_async_fifo/core.yaml", "category": "IPcore", "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "DGUARD", + "name": "async_rst", "type": [ "port" ] @@ -354,23 +602,23 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "HDMI_CLK_P", + "name": "m_axis", "type": [ - "port" + "iface_AXI4Stream" ] }, { "direction": "input", "maxConnectionsCount": -1, - "name": "PXLCLK_5X_I", + "name": "m_clk", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "LOCKED_I", + "name": "m_status_bad_frame", "type": [ "port" ] @@ -378,15 +626,15 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "HDMI_D0_P", + "name": "m_status_good_frame", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "DIH", + "name": "m_status_overflow", "type": [ "port" ] @@ -394,23 +642,23 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "DIEN", + "name": "s_axis", "type": [ - "port" + "iface_AXI4Stream" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "HDMI_CLK_N", + "name": "s_clk", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "VGA_HS", + "name": "s_status_bad_frame", "type": [ "port" ] @@ -418,23 +666,69 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "HDMI_D1_N", + "name": "s_status_good_frame", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "DATA_I", + "name": "s_status_overflow", "type": [ "port" ] + } + ], + "layer": "IP Cores", + "name": "axis_async_fifo", + "properties": [ + { + "default": "8", + "name": "DATA_WIDTH", + "type": "text" + }, + { + "default": "8", + "name": "DEST_WIDTH", + "type": "text" + }, + { + "default": "0", + "name": "ID_ENABLE", + "type": "text" + }, + { + "default": "8", + "name": "ID_WIDTH", + "type": "text" + }, + { + "default": "(DATA_WIDTH+7)/8", + "name": "KEEP_WIDTH", + "type": "text" + }, + { + "default": "1", + "name": "USER_ENABLE", + "type": "text" }, + { + "default": "1", + "name": "USER_WIDTH", + "type": "text" + } + ] + }, + { + "abstract": false, + "additionalData": "repo[builtin]:cores/axis_dwidth_converter/core.yaml", + "category": "IPcore", + "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "VGUARD", + "name": "aclk", "type": [ "port" ] @@ -442,7 +736,7 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "VGA_VS", + "name": "aresetn", "type": [ "port" ] @@ -450,31 +744,44 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "HDMI_D2_P", + "name": "m_axis", "type": [ - "port" + "iface_AXI4Stream" ] }, { "direction": "input", "maxConnectionsCount": -1, - "name": "PXLCLK_I", + "name": "s_axis", "type": [ - "port" + "iface_AXI4Stream" ] - }, + } + ], + "layer": "IP Cores", + "name": "axis_dwidth_converter", + "properties": [ { - "direction": "input", - "maxConnectionsCount": -1, - "name": "VGA_DE", - "type": [ - "port" - ] + "default": "64", + "name": "IN_DATA_WIDTH", + "type": "text" }, { - "direction": "output", + "default": "32", + "name": "OUT_DATA_WIDTH", + "type": "text" + } + ] + }, + { + "abstract": false, + "additionalData": "file:examples/hdmi/ipcores/clock_crossing.yaml", + "category": "IPcore", + "interfaces": [ + { + "direction": "input", "maxConnectionsCount": -1, - "name": "HDMI_D1_P", + "name": "A", "type": [ "port" ] @@ -482,7 +789,7 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "HDMI_D2_N", + "name": "B", "type": [ "port" ] @@ -490,32 +797,32 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "CTL", + "name": "clkA", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "HDMI_D0_N", + "name": "clkB", "type": [ "port" ] } ], "layer": "IP Cores", - "name": "hdmi_tx" + "name": "clock_crossing" }, { "abstract": false, - "additionalData": "examples/hdmi/ipcores/litex_mmcm.yaml", + "additionalData": "file:examples/hdmi/ipcores/dma_axi_in_axis_out.yaml", "category": "IPcore", "interfaces": [ { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "clkgen_out1", + "name": "clock", "type": [ "port" ] @@ -523,15 +830,15 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "clkgen_locked", + "name": "io_irq_readerDone", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "sys_clk", + "name": "io_irq_writerDone", "type": [ "port" ] @@ -539,7 +846,7 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "clkgen_ref", + "name": "io_sync_readerSync", "type": [ "port" ] @@ -547,7 +854,7 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "sys_rst", + "name": "io_sync_writerSync", "type": [ "port" ] @@ -555,7 +862,23 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "clkgen_out0", + "name": "m_axi", + "type": [ + "iface_AXI4" + ] + }, + { + "direction": "output", + "maxConnectionsCount": -1, + "name": "m_axis", + "type": [ + "iface_AXI4Stream" + ] + }, + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "reset", "type": [ "port" ] @@ -563,40 +886,40 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "axi", + "name": "s_axi", "type": [ "iface_AXI4Lite" ] } ], "layer": "IP Cores", - "name": "litex_mmcm" + "name": "dma_axi_in_axis_out" }, { "abstract": false, - "additionalData": "examples/hdmi/ipcores/proc_sys_reset.yaml", + "additionalData": "file:examples/hdmi/ipcores/hdmi_tx.yaml", "category": "IPcore", "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "ext_reset_in", + "name": "CTL", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "mb_reset", + "name": "DATA_I", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "interconnect_aresetn", + "name": "DGUARD", "type": [ "port" ] @@ -604,7 +927,7 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "aux_reset_in", + "name": "DIEN", "type": [ "port" ] @@ -612,7 +935,7 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "dcm_locked", + "name": "DIH", "type": [ "port" ] @@ -620,7 +943,7 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "peripheral_reset", + "name": "HDMI_CLK_N", "type": [ "port" ] @@ -628,23 +951,23 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "peripheral_aresetn", + "name": "HDMI_CLK_P", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "mb_debug_sys_rst", + "name": "HDMI_D0_N", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "slowest_sync_clk", + "name": "HDMI_D0_P", "type": [ "port" ] @@ -652,48 +975,39 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "bus_struct_reset", + "name": "HDMI_D1_N", "type": [ "port" ] - } - ], - "layer": "IP Cores", - "name": "proc_sys_reset" - }, - { - "abstract": false, - "additionalData": "examples/hdmi/ipcores/ps7.yaml", - "category": "IPcore", - "interfaces": [ + }, { "direction": "output", "maxConnectionsCount": -1, - "name": "SAXIHP0RCOUNT", + "name": "HDMI_D1_P", "type": [ "port" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ddr_bankaddr", + "name": "HDMI_D2_N", "type": [ "port" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ps_clk", + "name": "HDMI_D2_P", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_clk", + "name": "LOCKED_I", "type": [ "port" ] @@ -701,111 +1015,129 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "MAXIGP0ACLK", + "name": "PXLCLK_5X_I", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_cas_n", + "name": "PXLCLK_I", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_drstb", + "name": "VGA_DE", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "MAXIGP0ARESETN", + "name": "VGA_HS", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_odt", + "name": "VGA_VS", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_cs_n", + "name": "VGUARD", "type": [ "port" ] - }, + } + ], + "layer": "IP Cores", + "name": "hdmi_tx" + }, + { + "abstract": false, + "additionalData": "file:examples/hdmi/ipcores/litex_mmcm.yaml", + "category": "IPcore", + "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "IRQ_F2P_1", + "name": "axi", "type": [ - "port" + "iface_AXI4Lite" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ddr_ras_n", + "name": "clkgen_locked", "type": [ "port" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ps_mio", + "name": "clkgen_out0", "type": [ "port" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ps_srstb", + "name": "clkgen_out1", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_web", + "name": "clkgen_ref", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_dqs", + "name": "sys_clk", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "FCLK0", + "name": "sys_rst", "type": [ "port" ] - }, + } + ], + "layer": "IP Cores", + "name": "litex_mmcm" + }, + { + "abstract": false, + "additionalData": "file:examples/hdmi/ipcores/proc_sys_reset.yaml", + "category": "IPcore", + "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "SAXIHP0ACLK", + "name": "aux_reset_in", "type": [ "port" ] @@ -813,23 +1145,23 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "FCLK_RESET0_N", + "name": "bus_struct_reset", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "SAXIHP0RACOUNT", + "name": "dcm_locked", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_dm", + "name": "ext_reset_in", "type": [ "port" ] @@ -837,39 +1169,39 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "SAXIHP0ARESETN", + "name": "interconnect_aresetn", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_addr", + "name": "mb_debug_sys_rst", "type": [ "port" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ddr_dqs_n", + "name": "mb_reset", "type": [ "port" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ps_porb", + "name": "peripheral_aresetn", "type": [ "port" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ddr_cke", + "name": "peripheral_reset", "type": [ "port" ] @@ -877,23 +1209,32 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "IRQ_F2P_0", + "name": "slowest_sync_clk", "type": [ "port" ] - }, + } + ], + "layer": "IP Cores", + "name": "proc_sys_reset" + }, + { + "abstract": false, + "additionalData": "file:examples/hdmi/ipcores/ps7.yaml", + "category": "IPcore", + "interfaces": [ { "direction": "output", "maxConnectionsCount": -1, - "name": "SAXIHP0WCOUNT", + "name": "FCLK0", "type": [ "port" ] }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "ddr_vr_n", + "name": "FCLK1", "type": [ "port" ] @@ -901,31 +1242,31 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "FCLK1", + "name": "FCLK_RESET0_N", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_dq", + "name": "IRQ_F2P_0", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_clk_n", + "name": "IRQ_F2P_1", "type": [ "port" ] }, { - "direction": "inout", + "direction": "input", "maxConnectionsCount": -1, - "name": "ddr_vr", + "name": "MAXIGP0ACLK", "type": [ "port" ] @@ -933,7 +1274,7 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "SAXIHP0WACOUNT", + "name": "MAXIGP0ARESETN", "type": [ "port" ] @@ -949,571 +1290,230 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "S_AXI_HP0", + "name": "SAXIHP0ACLK", "type": [ - "iface_AXI3" + "port" ] - } - ], - "layer": "IP Cores", - "name": "ps7" - }, - { - "abstract": false, - "additionalData": "topwrap/ips/axi/axi_axil_adapter.yaml", - "category": "IPcore", - "interfaces": [ + }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "clk", + "name": "SAXIHP0ARESETN", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "rst", + "name": "SAXIHP0RACOUNT", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "s_axi", + "name": "SAXIHP0RCOUNT", "type": [ - "iface_AXI4" + "port" ] }, { "direction": "output", "maxConnectionsCount": -1, - "name": "m_axi", + "name": "SAXIHP0WACOUNT", "type": [ - "iface_AXI4Lite" + "port" ] - } - ], - "layer": "IP Cores", - "name": "axi_axil_adapter", - "properties": [ - { - "default": "32", - "name": "ADDR_WIDTH", - "type": "text" }, { - "default": "32", - "name": "AXI_DATA_WIDTH", - "type": "text" + "direction": "output", + "maxConnectionsCount": -1, + "name": "SAXIHP0WCOUNT", + "type": [ + "port" + ] }, - { - "default": "8", - "name": "AXI_ID_WIDTH", - "type": "text" - }, - { - "default": "AXI_DATA_WIDTH/8", - "name": "AXI_STRB_WIDTH", - "type": "text" - }, - { - "default": "32", - "name": "AXIL_DATA_WIDTH", - "type": "text" - }, - { - "default": "AXIL_DATA_WIDTH/8", - "name": "AXIL_STRB_WIDTH", - "type": "text" - } - ] - }, - { - "abstract": false, - "additionalData": "topwrap/ips/axi/axi_interconnect.yaml", - "category": "IPcore", - "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "clk", + "name": "S_AXI_HP0", "type": [ - "port" + "iface_AXI3" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "rst", + "name": "ddr_addr", "type": [ "port" ] }, { - "direction": "input", - "maxConnectionsCount": -1, - "name": "s_axi_0", - "type": [ - "iface_AXI4" - ] - }, - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "m_axi_0", - "type": [ - "iface_AXI4" - ] - }, - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "m_axi_1", - "type": [ - "iface_AXI4" - ] - }, - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "m_axi_2", - "type": [ - "iface_AXI4" - ] - } - ], - "layer": "IP Cores", - "name": "axi_interconnect", - "properties": [ - { - "default": "1", - "name": "S_COUNT", - "type": "text" - }, - { - "default": "4", - "name": "M_COUNT", - "type": "text" - }, - { - "default": "32", - "name": "DATA_WIDTH", - "type": "text" - }, - { - "default": "32", - "name": "ADDR_WIDTH", - "type": "text" - }, - { - "default": "12", - "name": "ID_WIDTH", - "type": "text" - }, - { - "default": "0", - "name": "M_BASE_ADDR", - "type": "text" - }, - { - "default": "96'h100000001000000010", - "name": "M_ADDR_WIDTH", - "type": "text" - }, - { - "default": "1", - "name": "AWUSER_WIDTH", - "type": "text" - }, - { - "default": "1", - "name": "WUSER_WIDTH", - "type": "text" - }, - { - "default": "1", - "name": "ARUSER_WIDTH", - "type": "text" - }, - { - "default": "1", - "name": "BUSER_WIDTH", - "type": "text" - }, - { - "default": "1", - "name": "RUSER_WIDTH", - "type": "text" - }, - { - "default": "DATA_WIDTH/8", - "name": "STRB_WIDTH", - "type": "text" - } - ] - }, - { - "abstract": false, - "additionalData": "topwrap/ips/axi/axi_protocol_converter.yaml", - "category": "IPcore", - "interfaces": [ - { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "aclk", + "name": "ddr_bankaddr", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "aresetn", + "name": "ddr_cas_n", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "S_AXI", + "name": "ddr_cke", "type": [ - "iface_AXI4" + "port" ] }, { - "direction": "output", - "maxConnectionsCount": -1, - "name": "M_AXI", - "type": [ - "iface_AXI3" - ] - } - ], - "layer": "IP Cores", - "name": "axi_protocol_converter" - }, - { - "abstract": false, - "additionalData": "topwrap/ips/axi/axis_dwidth_converter.yaml", - "category": "IPcore", - "interfaces": [ - { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "aclk", + "name": "ddr_clk", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "aresetn", + "name": "ddr_clk_n", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "s_axis", + "name": "ddr_cs_n", "type": [ - "iface_AXI4Stream" + "port" ] }, { - "direction": "output", + "direction": "inout", "maxConnectionsCount": -1, - "name": "m_axis", + "name": "ddr_dm", "type": [ - "iface_AXI4Stream" + "port" ] - } - ], - "layer": "IP Cores", - "name": "axis_dwidth_converter", - "properties": [ - { - "default": "64", - "name": "IN_DATA_WIDTH", - "type": "text" }, { - "default": "32", - "name": "OUT_DATA_WIDTH", - "type": "text" - } - ] - }, - { - "abstract": false, - "additionalData": "topwrap/ips/axi/axis_async_fifo.yaml", - "category": "IPcore", - "interfaces": [ - { - "direction": "output", + "direction": "inout", "maxConnectionsCount": -1, - "name": "s_status_bad_frame", + "name": "ddr_dq", "type": [ "port" ] }, { - "direction": "output", + "direction": "inout", "maxConnectionsCount": -1, - "name": "s_status_good_frame", + "name": "ddr_dqs", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "async_rst", + "name": "ddr_dqs_n", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "m_clk", + "name": "ddr_drstb", "type": [ "port" ] }, { - "direction": "output", + "direction": "inout", "maxConnectionsCount": -1, - "name": "m_status_overflow", + "name": "ddr_odt", "type": [ "port" ] }, { - "direction": "output", + "direction": "inout", "maxConnectionsCount": -1, - "name": "m_status_bad_frame", + "name": "ddr_ras_n", "type": [ "port" ] }, { - "direction": "output", + "direction": "inout", "maxConnectionsCount": -1, - "name": "s_status_overflow", + "name": "ddr_vr", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "s_clk", + "name": "ddr_vr_n", "type": [ "port" ] }, { - "direction": "output", + "direction": "inout", "maxConnectionsCount": -1, - "name": "m_status_good_frame", + "name": "ddr_web", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "s_axis", + "name": "ps_clk", "type": [ - "iface_AXI4Stream" + "port" ] }, { - "direction": "output", + "direction": "inout", "maxConnectionsCount": -1, - "name": "m_axis", + "name": "ps_mio", "type": [ - "iface_AXI4Stream" + "port" ] - } - ], - "layer": "IP Cores", - "name": "axis_async_fifo", - "properties": [ - { - "default": "8", - "name": "DATA_WIDTH", - "type": "text" - }, - { - "default": "(DATA_WIDTH+7)/8", - "name": "KEEP_WIDTH", - "type": "text" - }, - { - "default": "8", - "name": "ID_WIDTH", - "type": "text" - }, - { - "default": "8", - "name": "DEST_WIDTH", - "type": "text" - }, - { - "default": "1", - "name": "USER_WIDTH", - "type": "text" }, - { - "default": "0", - "name": "ID_ENABLE", - "type": "text" - }, - { - "default": "1", - "name": "USER_ENABLE", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "input", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port", - "iface_AXI4Lite", - "iface_AXI3", - "iface_AXI4", - "iface_AXI4Stream" - ] - } - ], - "layer": "Externals", - "name": "External Output", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port", - "iface_AXI4Lite", - "iface_AXI3", - "iface_AXI4", - "iface_AXI4Stream" - ] - } - ], - "layer": "Externals", - "name": "External Input", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ { "direction": "inout", "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port", - "iface_AXI4Lite", - "iface_AXI3", - "iface_AXI4", - "iface_AXI4Stream" - ] - } - ], - "layer": "Externals", - "name": "External Inout", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "constant", - "type": [ - "port", - "iface_AXI4Lite", - "iface_AXI3", - "iface_AXI4", - "iface_AXI4Stream" - ] - } - ], - "layer": "Constants", - "name": "Constant", - "properties": [ - { - "default": "0", - "name": "Constant Value", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "subgraph out", + "name": "ps_porb", "type": [ "port" ] }, { - "direction": "input", + "direction": "inout", "maxConnectionsCount": -1, - "name": "subgraph in", + "name": "ps_srstb", "type": [ "port" ] } ], - "layer": "Externals", - "name": "Subgraph port" + "layer": "IP Cores", + "name": "ps7" } ] } diff --git a/tests/data/data_kpm/examples/hierarchy/project_hierarchy.yaml b/tests/data/data_kpm/examples/hierarchy/project_hierarchy.yaml deleted file mode 100644 index 2708ab4f..00000000 --- a/tests/data/data_kpm/examples/hierarchy/project_hierarchy.yaml +++ /dev/null @@ -1,117 +0,0 @@ -design: - hierarchies: - complex_sub: - design: - hierarchies: - sub_1: - design: - parameters: - s1_mod_3: - SUB_VALUE: 18 - ports: - s1_mod_1: - cs_s1_f_ext_const_in: cs_s1_int_const_in - cs_s1_f_mod_in_1: cs_s1_mod_in_1 - s1_mod_2: - cs_s1_f_int_out_1: cs_s1_int_out_1 - cs_s1_mint_in_1: [s1_mod_1, cs_s1_mint_out_1] - s1_mod_3: - cs_s1_f_int_out_2: cs_s1_int_out_2 - cs_s1_mint_in_2: [s1_mod_1, cs_s1_mint_out_1] - external: - ports: - in: - - cs_s1_int_const_in - - cs_s1_mod_in_1 - - cs_s1_empty_in - out: - - cs_s1_int_out_1 - - cs_s1_int_out_2 - - cs_s1_empty_out - ips: - s1_mod_1: - file: examples/hierarchy/repo/cores/s1_mod_1/s1_mod_1.yaml - s1_mod_2: - file: examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml - s1_mod_3: - file: examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml - sub_2: - design: - ports: - s2_mod_1: - cs_s2_f_int_in_1: cs_s2_int_in_1 - cs_s2_f_int_in_2: cs_s2_int_in_2 - s2_mod_2: - cs_s2_f_mod_out_1: cs_s2_mod_out_1 - cs_s2_mint_in_1: [s2_mod_1, cs_s2_mint_out_1] - cs_s2_mint_in_2: [s2_mod_1, cs_s2_mint_out_2] - external: - ports: - in: - - cs_s2_int_in_2 - - cs_s2_int_in_1 - out: - - cs_s2_mod_out_1 - ips: - s2_mod_1: - file: examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml - s2_mod_2: - file: examples/hierarchy/repo/cores/s2_mod_2/s2_mod_2.yaml - ports: - sub_1: - cs_s1_int_const_in: 1 - cs_s1_mod_in_1: cs_in_1 - sub_2: - cs_s2_int_in_1: [sub_1, cs_s1_int_out_1] - cs_s2_int_in_2: [sub_1, cs_s1_int_out_2] - cs_s2_mod_out_1: cs_out_1 - external: - ports: - in: - - cs_in_1 - - cs_empty_port_in - out: - - cs_out_1 - counter: - design: - parameters: - c_mod_1: - MAX_VALUE: 16 - ports: - c_mod_1: - c_mod_in_1: c_in_1 - c_mod_2: - c_mod_in_2: c_in_2 - c_mod_3: - c_int_const_in: 1 - c_int_in_1: [c_mod_2, c_int_out_2] - c_int_in_2: [c_mod_1, c_int_out_1] - c_mod_out_1: c_out_1 - external: - ports: - in: - - c_in_1 - - c_in_2 - out: - - c_out_1 - ips: - c_mod_1: - file: examples/hierarchy/repo/cores/c_mod_1/c_mod_1.yaml - c_mod_2: - file: examples/hierarchy/repo/cores/c_mod_2/c_mod_2.yaml - c_mod_3: - file: examples/hierarchy/repo/cores/c_mod_3/c_mod_3.yaml - ports: - complex_sub: - cs_in_1: [counter, c_out_1] - cs_out_1: ex_in_1 - counter: - c_in_1: ex_out_1 - c_in_2: ex_out_2 -external: - ports: - in: - - ex_out_1 - - ex_out_2 - out: - - ex_in_1 diff --git a/tests/data/data_kpm/examples/hierarchy/specification_hierarchy.json b/tests/data/data_kpm/examples/hierarchy/specification_hierarchy.json index d90b6302..11779697 100644 --- a/tests/data/data_kpm/examples/hierarchy/specification_hierarchy.json +++ b/tests/data/data_kpm/examples/hierarchy/specification_hierarchy.json @@ -13,9 +13,9 @@ }, "layers": [ { - "name": "IP Cores", + "name": "Constants", "nodeLayers": [ - "IP Cores" + "Constants" ] }, { @@ -25,9 +25,9 @@ ] }, { - "name": "Constants", + "name": "IP Cores", "nodeLayers": [ - "Constants" + "IP Cores" ] } ], @@ -61,7 +61,123 @@ "nodes": [ { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/c_mod_1/c_mod_1.yaml", + "category": "Metanode", + "interfaces": [ + { + "direction": "output", + "maxConnectionsCount": -1, + "name": "constant", + "type": [ + "port" + ] + } + ], + "layer": "Constants", + "name": "Constant", + "properties": [ + { + "default": "0", + "name": "Constant Value", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ + { + "direction": "inout", + "maxConnectionsCount": -1, + "name": "external", + "type": [ + "port" + ] + } + ], + "layer": "Externals", + "name": "External Inout", + "properties": [ + { + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ + { + "direction": "output", + "maxConnectionsCount": -1, + "name": "external", + "type": [ + "port" + ] + } + ], + "layer": "Externals", + "name": "External Input", + "properties": [ + { + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "external", + "type": [ + "port" + ] + } + ], + "layer": "Externals", + "name": "External Output", + "properties": [ + { + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "subgraph in", + "type": [ + "port" + ] + }, + { + "direction": "output", + "maxConnectionsCount": -1, + "name": "subgraph out", + "type": [ + "port" + ] + } + ], + "layer": "Externals", + "name": "Subgraph port" + }, + { + "abstract": false, + "additionalData": "file:examples/hierarchy/repo/cores/c_mod_1/c_mod_1.yaml", "category": "IPcore", "interfaces": [ { @@ -93,21 +209,21 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/c_mod_2/c_mod_2.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/c_mod_2/c_mod_2.yaml", "category": "IPcore", "interfaces": [ { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "c_mod_in_2", + "name": "c_int_out_2", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "c_int_out_2", + "name": "c_mod_in_2", "type": [ "port" ] @@ -118,7 +234,7 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/c_mod_3/c_mod_3.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/c_mod_3/c_mod_3.yaml", "category": "IPcore", "interfaces": [ { @@ -130,9 +246,9 @@ ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "c_mod_out_1", + "name": "c_int_in_1", "type": [ "port" ] @@ -146,9 +262,9 @@ ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "c_int_in_1", + "name": "c_mod_out_1", "type": [ "port" ] @@ -159,7 +275,7 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s1_mod_1/s1_mod_1.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s1_mod_1/s1_mod_1.yaml", "category": "IPcore", "interfaces": [ { @@ -192,7 +308,7 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s1_mod_2/s1_mod_2.yaml", "category": "IPcore", "interfaces": [ { @@ -217,7 +333,7 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s1_mod_3/s1_mod_3.yaml", "category": "IPcore", "interfaces": [ { @@ -249,13 +365,13 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s2_mod_1/s2_mod_1.yaml", "category": "IPcore", "interfaces": [ { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "cs_s2_mint_out_1", + "name": "cs_s2_f_int_in_1", "type": [ "port" ] @@ -263,15 +379,15 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "cs_s2_f_int_in_1", + "name": "cs_s2_f_int_in_2", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "cs_s2_f_int_in_2", + "name": "cs_s2_mint_out_1", "type": [ "port" ] @@ -290,7 +406,7 @@ }, { "abstract": false, - "additionalData": "examples/hierarchy/repo/cores/s2_mod_2/s2_mod_2.yaml", + "additionalData": "file:examples/hierarchy/repo/cores/s2_mod_2/s2_mod_2.yaml", "category": "IPcore", "interfaces": [ { @@ -320,122 +436,6 @@ ], "layer": "IP Cores", "name": "s2_mod_2" - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "input", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port" - ] - } - ], - "layer": "Externals", - "name": "External Output", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port" - ] - } - ], - "layer": "Externals", - "name": "External Input", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "inout", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port" - ] - } - ], - "layer": "Externals", - "name": "External Inout", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "constant", - "type": [ - "port" - ] - } - ], - "layer": "Constants", - "name": "Constant", - "properties": [ - { - "default": "0", - "name": "Constant Value", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "output", - "maxConnectionsCount": -1, - "name": "subgraph out", - "type": [ - "port" - ] - }, - { - "direction": "input", - "maxConnectionsCount": -1, - "name": "subgraph in", - "type": [ - "port" - ] - } - ], - "layer": "Externals", - "name": "Subgraph port" } ] } diff --git a/tests/data/data_kpm/examples/pwm/project_pwm.yaml b/tests/data/data_kpm/examples/pwm/project_pwm.yaml deleted file mode 100644 index 3f448feb..00000000 --- a/tests/data/data_kpm/examples/pwm/project_pwm.yaml +++ /dev/null @@ -1,35 +0,0 @@ -design: - interfaces: - axi_bridge: - s_axi: [ps7, M_AXI_GP0] - litex_pwm_top: - s_axi: [axi_bridge, m_axi] - parameters: - axi_bridge: - ADDR_WIDTH: 32 - AXIL_DATA_WIDTH: 32 - AXIL_STRB_WIDTH: AXIL_DATA_WIDTH/8 - AXI_DATA_WIDTH: 32 - AXI_ID_WIDTH: 12 - AXI_STRB_WIDTH: AXI_DATA_WIDTH/8 - ports: - axi_bridge: - clk: [ps7, FCLK0] - rst: [ps7, FCLK_RESET0_N] - litex_pwm_top: - pwm: pwm - sys_clk: [ps7, FCLK0] - sys_rst: [ps7, FCLK_RESET0_N] - ps7: - MAXIGP0ACLK: [ps7, FCLK0] -external: - ports: - out: - - pwm -ips: - axi_bridge: - file: topwrap/ips/axi/axi_axil_adapter.yaml - litex_pwm_top: - file: examples/pwm/ipcores/litex_pwm.yaml - ps7: - file: examples/pwm/ipcores/ps7.yaml diff --git a/tests/data/data_kpm/examples/pwm/specification_pwm.json b/tests/data/data_kpm/examples/pwm/specification_pwm.json index 60126ee2..c7a75922 100644 --- a/tests/data/data_kpm/examples/pwm/specification_pwm.json +++ b/tests/data/data_kpm/examples/pwm/specification_pwm.json @@ -23,9 +23,9 @@ }, "layers": [ { - "name": "IP Cores", + "name": "Constants", "nodeLayers": [ - "IP Cores" + "Constants" ] }, { @@ -35,9 +35,9 @@ ] }, { - "name": "Constants", + "name": "IP Cores", "nodeLayers": [ - "Constants" + "IP Cores" ] } ], @@ -71,86 +71,112 @@ "nodes": [ { "abstract": false, - "additionalData": "topwrap/ips/axi/axi_axil_adapter.yaml", - "category": "IPcore", + "category": "Metanode", "interfaces": [ { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "clk", + "name": "constant", "type": [ + "iface_AXI4", + "iface_AXI4Lite", "port" ] - }, + } + ], + "layer": "Constants", + "name": "Constant", + "properties": [ { - "direction": "input", + "default": "0", + "name": "Constant Value", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ + { + "direction": "inout", "maxConnectionsCount": -1, - "name": "rst", + "name": "external", "type": [ + "iface_AXI4", + "iface_AXI4Lite", "port" ] - }, + } + ], + "layer": "Externals", + "name": "External Inout", + "properties": [ { - "direction": "input", - "maxConnectionsCount": -1, - "name": "s_axi", - "type": [ - "iface_AXI4" - ] - }, + "default": "", + "name": "External Name", + "type": "text" + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ { "direction": "output", "maxConnectionsCount": -1, - "name": "m_axi", + "name": "external", "type": [ - "iface_AXI4Lite" + "iface_AXI4", + "iface_AXI4Lite", + "port" ] } ], - "layer": "IP Cores", - "name": "axi_axil_adapter", + "layer": "Externals", + "name": "External Input", "properties": [ { - "default": "32", - "name": "ADDR_WIDTH", - "type": "text" - }, - { - "default": "32", - "name": "AXI_DATA_WIDTH", - "type": "text" - }, - { - "default": "8", - "name": "AXI_ID_WIDTH", - "type": "text" - }, - { - "default": "AXI_DATA_WIDTH/8", - "name": "AXI_STRB_WIDTH", + "default": "", + "name": "External Name", "type": "text" - }, + } + ] + }, + { + "abstract": false, + "category": "Metanode", + "interfaces": [ { - "default": "32", - "name": "AXIL_DATA_WIDTH", - "type": "text" - }, + "direction": "input", + "maxConnectionsCount": -1, + "name": "external", + "type": [ + "iface_AXI4", + "iface_AXI4Lite", + "port" + ] + } + ], + "layer": "Externals", + "name": "External Output", + "properties": [ { - "default": "AXIL_DATA_WIDTH/8", - "name": "AXIL_STRB_WIDTH", + "default": "", + "name": "External Name", "type": "text" } ] }, { "abstract": false, - "additionalData": "examples/pwm/ipcores/ps7.yaml", - "category": "IPcore", + "category": "Metanode", "interfaces": [ { "direction": "input", "maxConnectionsCount": -1, - "name": "MAXIGP0ACLK", + "name": "subgraph in", "type": [ "port" ] @@ -158,15 +184,24 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "MAXIGP0ARESETN", + "name": "subgraph out", "type": [ "port" ] - }, + } + ], + "layer": "Externals", + "name": "Subgraph port" + }, + { + "abstract": false, + "additionalData": "repo[builtin]:cores/axi_axil_adapter/core.yaml", + "category": "IPcore", + "interfaces": [ { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "FCLK0", + "name": "clk", "type": [ "port" ] @@ -174,26 +209,66 @@ { "direction": "output", "maxConnectionsCount": -1, - "name": "FCLK_RESET0_N", + "name": "m_axi", + "type": [ + "iface_AXI4Lite" + ] + }, + { + "direction": "input", + "maxConnectionsCount": -1, + "name": "rst", "type": [ "port" ] }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "M_AXI_GP0", + "name": "s_axi", "type": [ "iface_AXI4" ] } ], "layer": "IP Cores", - "name": "ps7" + "name": "axi_axil_adapter", + "properties": [ + { + "default": "32", + "name": "ADDR_WIDTH", + "type": "text" + }, + { + "default": "32", + "name": "AXIL_DATA_WIDTH", + "type": "text" + }, + { + "default": "AXIL_DATA_WIDTH/8", + "name": "AXIL_STRB_WIDTH", + "type": "text" + }, + { + "default": "32", + "name": "AXI_DATA_WIDTH", + "type": "text" + }, + { + "default": "8", + "name": "AXI_ID_WIDTH", + "type": "text" + }, + { + "default": "AXI_DATA_WIDTH/8", + "name": "AXI_STRB_WIDTH", + "type": "text" + } + ] }, { "abstract": false, - "additionalData": "examples/pwm/ipcores/litex_pwm.yaml", + "additionalData": "file:examples/pwm/ipcores/litex_pwm.yaml", "category": "IPcore", "interfaces": [ { @@ -207,9 +282,9 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "sys_rst", + "name": "s_axi", "type": [ - "port" + "iface_AXI4Lite" ] }, { @@ -223,9 +298,9 @@ { "direction": "input", "maxConnectionsCount": -1, - "name": "s_axi", + "name": "sys_rst", "type": [ - "iface_AXI4Lite" + "port" ] } ], @@ -234,127 +309,52 @@ }, { "abstract": false, - "category": "Metanode", - "interfaces": [ - { - "direction": "input", - "maxConnectionsCount": -1, - "name": "external", - "type": [ - "port", - "iface_AXI4Lite", - "iface_AXI4" - ] - } - ], - "layer": "Externals", - "name": "External Output", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", + "additionalData": "file:examples/pwm/ipcores/ps7.yaml", + "category": "IPcore", "interfaces": [ { "direction": "output", "maxConnectionsCount": -1, - "name": "external", + "name": "FCLK0", "type": [ - "port", - "iface_AXI4Lite", - "iface_AXI4" + "port" ] - } - ], - "layer": "Externals", - "name": "External Input", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ + }, { - "direction": "inout", + "direction": "output", "maxConnectionsCount": -1, - "name": "external", + "name": "FCLK_RESET0_N", "type": [ - "port", - "iface_AXI4Lite", - "iface_AXI4" + "port" ] - } - ], - "layer": "Externals", - "name": "External Inout", - "properties": [ - { - "default": "", - "name": "External Name", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ + }, { - "direction": "output", + "direction": "input", "maxConnectionsCount": -1, - "name": "constant", + "name": "MAXIGP0ACLK", "type": [ - "port", - "iface_AXI4Lite", - "iface_AXI4" + "port" ] - } - ], - "layer": "Constants", - "name": "Constant", - "properties": [ - { - "default": "0", - "name": "Constant Value", - "type": "text" - } - ] - }, - { - "abstract": false, - "category": "Metanode", - "interfaces": [ + }, { "direction": "output", "maxConnectionsCount": -1, - "name": "subgraph out", + "name": "MAXIGP0ARESETN", "type": [ "port" ] }, { - "direction": "input", + "direction": "output", "maxConnectionsCount": -1, - "name": "subgraph in", + "name": "M_AXI_GP0", "type": [ - "port" + "iface_AXI4" ] } ], - "layer": "Externals", - "name": "Subgraph port" + "layer": "IP Cores", + "name": "ps7" } ] } diff --git a/tests/test_config.py b/tests/test_config.py index 7d0cb57d..ef2ee684 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -3,35 +3,33 @@ import logging from pathlib import Path +from tempfile import NamedTemporaryFile import pytest import yaml -from topwrap.config import Config, ConfigManager, RepositoryEntry +from topwrap.config import Config, ConfigManager +from topwrap.resource_field import FileHandler, UriHandler class TestConfigManager: @pytest.fixture def config_dict(self): - return Config.Schema().dump( - Config( - force_interface_compliance=True, - repositories=[ - RepositoryEntry("My topwrap repo", "~/custom/repo/path"), - ], - ) - ) + return Config( + force_interface_compliance=True, + repositories={"my_repo": FileHandler("~/custom/repo/path")}, + ).to_dict() @pytest.fixture def custom_config_dicts(self): return [ ( - "custom/path/cfg.yaml", - Config.Schema().dump(Config(repositories=[RepositoryEntry("repo1", "path1")])), + Path("custom/path/cfg.yaml"), + Config(repositories={"repo1": FileHandler("path1")}).to_dict(), ), ( - "/global/path/mycfg.yaml", - Config.Schema().dump(Config(repositories=[RepositoryEntry("repo2", "path2")])), + Path("/global/path/mycfg.yaml"), + Config(repositories={"repo2": FileHandler("path2")}).to_dict(), ), ] @@ -61,74 +59,58 @@ def contains_warnings_in_log(caplog): return True return False - def test_adding_repo_duplicates(self, fs, config_dict, caplog): - (repo_dict,) = config_dict["repositories"] + def test_adding_repo_duplicates_and_order(self): + configs = [ + Config(repositories={"my_repo": FileHandler("./foo")}), + Config( + repositories={ + "my_repo": FileHandler("./bar"), + "zwei_repo": UriHandler("https://antmicro.com"), + } + ), + Config(repositories={"my_repo": FileHandler("./baz")}), + ] + + files = [] - manager = ConfigManager() - for path in manager.search_paths: - config_str = yaml.dump(config_dict) - fs.create_file(path, contents=config_str) + for conf in configs: + f = NamedTemporaryFile() + conf.save(Path(f.name)) + files.append(f) - config = manager.load() - assert len(config.repositories) == 1 - assert not self.contains_warnings_in_log(caplog) + manager = ConfigManager([Path(f.name) for f in files]) + conf = manager.load() - def test_loading_order(self, fs, config_dict, caplog): - (repo_dict,) = config_dict["repositories"] + assert len(conf.repositories) == 2 + assert conf.repositories["my_repo"].to_str().endswith("foo") - manager = ConfigManager() - for i, path in enumerate(manager.search_paths): - repo_dict["name"] = str(i) - repo_dict["path"] = str(path) + def test_config_override(self, config_dict, caplog): + with NamedTemporaryFile(mode="w+") as tmp: config_str = yaml.dump(config_dict) - fs.create_file(path, contents=config_str) + tmp.write(config_str) + tmp.flush() - config = manager.load() - assert config.repositories == [ - RepositoryEntry(name=str(i), path=str(manager.search_paths[i])) - for i in reversed(range(len(manager.search_paths))) - ] - assert not self.contains_warnings_in_log(caplog) + manager = ConfigManager([Path(tmp.name)]) + config = manager.load() + assert config.force_interface_compliance is True + assert config.repositories["my_repo"].value == "~/custom/repo/path" - def test_custom_search_patchs(self, fs, custom_config_dicts, caplog): - for path, config_dict in custom_config_dicts: - config_str = yaml.dump(config_dict) - fs.create_file(path, contents=config_str) - - paths, config_dicts = zip(*custom_config_dicts) - config = ConfigManager(paths).load() - assert len(config.repositories) == len(config_dicts) - assert not self.contains_warnings_in_log(caplog) - - def test_config_override(self, fs, config_dict, caplog): - config_path = Path(ConfigManager.DEFAULT_SEARCH_PATHS[0]).expanduser() - config_str = yaml.dump(config_dict) - fs.create_file(config_path, contents=config_str) - - manager = ConfigManager() - - (repo_dict,) = config_dict["repositories"] - - config = manager.load() - assert config.force_interface_compliance is True - assert config.repositories == [RepositoryEntry(repo_dict["name"], repo_dict["path"])] - - override_config = Config( - force_interface_compliance=False, - repositories=None, - ) - - config2 = manager.load(override_config) - assert config2.force_interface_compliance is False - assert config2.repositories == [RepositoryEntry(repo_dict["name"], repo_dict["path"])] - assert not self.contains_warnings_in_log(caplog) - - def test_loading_incorrect_configs(self, fs, incorrect_config_dicts, caplog): - config_path = Path(ConfigManager.DEFAULT_SEARCH_PATHS[0]).expanduser() - for incorrect_config in incorrect_config_dicts: - manager = ConfigManager() - config_str = yaml.dump(incorrect_config) - fs.create_file(config_path, contents=config_str) - manager.load() - assert self.contains_warnings_in_log(caplog) - config_path.unlink() + override_config = Config( + force_interface_compliance=False, + repositories={}, + ) + + config2 = manager.load(override_config) + assert config2.force_interface_compliance is False + assert config.repositories["my_repo"].value == "~/custom/repo/path" + assert not self.contains_warnings_in_log(caplog) + + def test_loading_incorrect_configs(self, incorrect_config_dicts, caplog): + with NamedTemporaryFile(mode="w+") as config_path: + for incorrect_config in incorrect_config_dicts: + manager = ConfigManager([Path(config_path.name)]) + config_str = yaml.dump(incorrect_config) + config_path.write(config_str) + config_path.flush() + manager.load() + assert self.contains_warnings_in_log(caplog) diff --git a/tests/tests_kpm/conftest.py b/tests/tests_kpm/conftest.py index 08237409..df718852 100644 --- a/tests/tests_kpm/conftest.py +++ b/tests/tests_kpm/conftest.py @@ -3,7 +3,7 @@ from base64 import b64encode from pathlib import Path -from typing import Dict, List +from typing import Dict import pytest @@ -11,77 +11,6 @@ from topwrap.util import JsonType, read_json_file -def pwm_ipcores_yamls_data() -> List[Path]: - _pwm_yamls_prefix = Path("examples/pwm/ipcores/") - return [ - Path("topwrap/ips/axi/axi_axil_adapter.yaml"), - _pwm_yamls_prefix / "ps7.yaml", - _pwm_yamls_prefix / "litex_pwm.yaml", - ] - - -@pytest.fixture -def pwm_ipcores_yamls() -> List[Path]: - return pwm_ipcores_yamls_data() - - -def hdmi_ipcores_yamls_data() -> List[Path]: - _hdmi_yamls_prefix = Path("examples/hdmi/ipcores/") - _axi_yamls_prefix = Path("topwrap/ips/axi/") - return [ - _hdmi_yamls_prefix / "axi_dispctrl.yaml", - _hdmi_yamls_prefix / "clock_crossing.yaml", - _hdmi_yamls_prefix / "dma_axi_in_axis_out.yaml", - _hdmi_yamls_prefix / "hdmi_tx.yaml", - _hdmi_yamls_prefix / "litex_mmcm.yaml", - _hdmi_yamls_prefix / "proc_sys_reset.yaml", - _hdmi_yamls_prefix / "ps7.yaml", - _axi_yamls_prefix / "axi_axil_adapter.yaml", - _axi_yamls_prefix / "axi_interconnect.yaml", - _axi_yamls_prefix / "axi_protocol_converter.yaml", - _axi_yamls_prefix / "axis_dwidth_converter.yaml", - _axi_yamls_prefix / "axis_async_fifo.yaml", - ] - - -@pytest.fixture -def hdmi_ipcores_yamls() -> List[Path]: - return hdmi_ipcores_yamls_data() - - -def hierarchy_ipcores_yamls_data() -> List[Path]: - _hierarchy_yamls_prefix = Path("examples/hierarchy/repo/cores/") - return [ - _hierarchy_yamls_prefix / "c_mod_1/c_mod_1.yaml", - _hierarchy_yamls_prefix / "c_mod_2/c_mod_2.yaml", - _hierarchy_yamls_prefix / "c_mod_3/c_mod_3.yaml", - _hierarchy_yamls_prefix / "s1_mod_1/s1_mod_1.yaml", - _hierarchy_yamls_prefix / "s1_mod_2/s1_mod_2.yaml", - _hierarchy_yamls_prefix / "s1_mod_3/s1_mod_3.yaml", - _hierarchy_yamls_prefix / "s2_mod_1/s2_mod_1.yaml", - _hierarchy_yamls_prefix / "s2_mod_2/s2_mod_2.yaml", - ] - - -@pytest.fixture -def hierarchy_ipcores_yamls() -> List[Path]: - return hierarchy_ipcores_yamls_data() - - -def all_yaml_files_data() -> Dict[str, List[Path]]: - return { - "pwm": pwm_ipcores_yamls_data(), - "hdmi": hdmi_ipcores_yamls_data(), - "hierarchy": hierarchy_ipcores_yamls_data(), - "complex": hierarchy_ipcores_yamls_data(), - } - - -@pytest.fixture -def all_yaml_files() -> Dict[str, List[Path]]: - return all_yaml_files_data() - - def test_dirs_data() -> Dict[str, Path]: COMMON = "tests/data/data_kpm/" paths = {} @@ -113,12 +42,20 @@ def all_dataflow_files(test_dirs: Dict[str, Path]) -> Dict[str, JsonType]: } +def all_designs_data() -> Dict[str, DesignDescription]: + data = {} + for ip_name, dir in test_dirs_data().items(): + if dir.parts[-2] == "examples": + data[ip_name] = DesignDescription.load(Path("examples") / ip_name / "project.yaml") + else: + data[ip_name] = DesignDescription.load(dir / f"project_{ip_name}.yaml") + + return data + + @pytest.fixture -def all_designs(test_dirs: Dict[str, Path]) -> Dict[str, DesignDescription]: - return { - ip_name: DesignDescription.load(dir / f"project_{ip_name}.yaml") - for ip_name, dir in test_dirs.items() - } +def all_designs() -> Dict[str, DesignDescription]: + return all_designs_data() @pytest.fixture diff --git a/tests/tests_kpm/test_kpm_client.py b/tests/tests_kpm/test_kpm_client.py index 9454f5c2..4f4e555b 100644 --- a/tests/tests_kpm/test_kpm_client.py +++ b/tests/tests_kpm/test_kpm_client.py @@ -4,7 +4,6 @@ import pytest from deepdiff import DeepDiff -from deepdiff.serialization import yaml from pipeline_manager_backend_communication.misc_structures import MessageType from pipeline_manager_backend_communication.utils import convert_message_to_string @@ -14,78 +13,79 @@ from topwrap.kpm_dataflow_parser import kpm_dataflow_to_design from topwrap.kpm_topwrap_client import RPCMethods from topwrap.util import JsonType +from topwrap.yamls_to_kpm_spec_parser import ipcore_yamls_to_kpm_spec class TestClient: @pytest.fixture def default_rpc_params(self): - return RPCparams("127.0.0.1", 9000, [], Path("build"), Path()) + return RPCparams("127.0.0.1", 9000, ipcore_yamls_to_kpm_spec([]), Path("build"), None) - def test_specification(self, all_yaml_files, all_specification_files, default_rpc_params): + def test_specification( + self, all_specification_files, all_designs, default_rpc_params: RPCparams + ): # Testing all cores - for test_name, ip_core_yamls in all_yaml_files.items(): - spec_json = all_specification_files[test_name] - - default_rpc_params.yamlfiles = ip_core_yamls + for test_name, spec in all_specification_files.items(): + default_rpc_params.specification = ipcore_yamls_to_kpm_spec([], all_designs[test_name]) specification_from_kpm = RPCMethods(default_rpc_params).specification_get() assert ( specification_from_kpm["type"] == MessageType.OK.value ), f"Test for {test_name} didn't return Message OK" spec_differences = DeepDiff( - specification_from_kpm["content"], - spec_json, + specification_from_kpm.get("content"), + spec, ignore_order=True, + ignore_type_in_groups=[(list, tuple)], ) assert ( spec_differences == {} ), f"Test {test_name} differs from original specification. Diff: {spec_differences}" - def test_dataflow_validation(self, all_yaml_files, all_dataflow_files, default_rpc_params): - for test_name, ip_core_yamls in all_yaml_files.items(): - dataflow_json = all_dataflow_files[test_name] - - default_rpc_params.yamlfiles = ip_core_yamls + def test_dataflow_validation( + self, all_dataflow_files, all_designs, default_rpc_params: RPCparams + ): + for test_name, dataflow_json in all_dataflow_files.items(): + default_rpc_params.specification = ipcore_yamls_to_kpm_spec([], all_designs[test_name]) response_message = RPCMethods(default_rpc_params).dataflow_validate(dataflow_json) assert ( response_message["type"] != MessageType.ERROR.value - ), f"Dataflow validation returned errors {response_message['content']} for test {test_name}" + ), f"Dataflow validation returned errors {response_message.get('content')} for test {test_name}" if response_message["type"] == MessageType.WARNING.value: - logging.warning(f"Dataflow {test_name} has warnings {response_message['content']}") - - def test_dataflow_run(self, all_yaml_files, all_dataflow_files, default_rpc_params): - for test_name, ip_core_yamls in all_yaml_files.items(): - dataflow_json = all_dataflow_files[test_name] + logging.warning( + f"Dataflow {test_name} has warnings {response_message.get('content')}" + ) - default_rpc_params.yamlfiles = ip_core_yamls + def test_dataflow_run(self, all_dataflow_files, all_designs, default_rpc_params: RPCparams): + for test_name, dataflow_json in all_dataflow_files.items(): + default_rpc_params.specification = ipcore_yamls_to_kpm_spec([], all_designs[test_name]) response_message = RPCMethods(default_rpc_params).dataflow_run(dataflow_json) assert ( response_message["type"] == MessageType.OK.value ), f"Dataflow run returned {response_message} for test {test_name}" - def test_dataflow_export( - self, all_yaml_files, all_dataflow_files, all_designs, default_rpc_params - ): - for test_name, ip_core_yamls in all_yaml_files.items(): - default_rpc_params.yamlfiles = ip_core_yamls - response_message = RPCMethods(default_rpc_params).dataflow_export( - all_dataflow_files[test_name] - ) + def test_dataflow_export(self, all_dataflow_files, all_designs, default_rpc_params: RPCparams): + for test_name, dataflow_json in all_dataflow_files.items(): + default_rpc_params.specification = ipcore_yamls_to_kpm_spec([], all_designs[test_name]) + response_message = RPCMethods(default_rpc_params).dataflow_export(dataflow_json) - response_design_dict = yaml.safe_load( + response_design_dict = DesignDescription.from_yaml( convert_message_to_string(response_message["content"], True, "application/x-yaml") ) # Dump design and load back with yaml to avoid errors with different types like tuple vs list - design_loaded_yaml = yaml.safe_load(all_designs[test_name].to_yaml()) - - design_diff = DeepDiff(design_loaded_yaml, response_design_dict, ignore_order=True) + # design_loaded_yaml = yaml.safe_load(all_designs[test_name].to_yaml()) + design_diff = DeepDiff( + all_designs[test_name].to_dict(), response_design_dict.to_dict(), ignore_order=True + ) assert ( design_diff == {} ), f"Dataflow export returned different encoded file for test {test_name}" - def test_dataflow_import(self, all_yaml_files, all_encoded_design_files, default_rpc_params): - for test_name, ip_core_yamls in all_yaml_files.items(): - default_rpc_params.yamlfiles = ip_core_yamls + def test_dataflow_import( + self, all_designs, all_encoded_design_files, default_rpc_params: RPCparams + ): + for test_name, design in all_designs.items(): + default_rpc_params.specification = ipcore_yamls_to_kpm_spec([], design) response_message = RPCMethods(default_rpc_params).dataflow_import( all_encoded_design_files[test_name], "application/x-yaml", True ) diff --git a/tests/tests_kpm/test_kpm_specification.py b/tests/tests_kpm/test_kpm_specification.py index 1426659a..f3b90b9a 100644 --- a/tests/tests_kpm/test_kpm_specification.py +++ b/tests/tests_kpm/test_kpm_specification.py @@ -18,6 +18,8 @@ PWM_ALL_UNIQUE_NODES = PWM_UNIQUE_IPCORE_NODES + SPEC_METANODES HDMI_UNIQUE_IPCORE_NODES = 12 # Unique IP Cores from examples/hdmi/project.yaml HDMI_ALL_UNIQUE_NODES = HDMI_UNIQUE_IPCORE_NODES + SPEC_METANODES +HIERARCHY_UNIQUE_IPCORE_NODES = 8 +HIERARCHY_ALL_UNIQUE_NODES = HIERARCHY_UNIQUE_IPCORE_NODES + SPEC_METANODES def get_schema_path(schema_name) -> Path: @@ -69,19 +71,25 @@ def schemas_registry(schemas_names) -> Registry: def test_pwm_specification_generation(specification_schema, pwm_design, schemas_registry): """Validate generated specification for PWM design.""" - pwm_specification = ipcore_yamls_to_kpm_spec(pwm_ipcores_yamls) + pwm_specification = ipcore_yamls_to_kpm_spec([], pwm_design) assert len(pwm_specification["nodes"]) == PWM_ALL_UNIQUE_NODES - Draft201909Validator(specification_schema, registry=schemas_registry).validate( - pwm_specification - ) + Validator(specification_schema, registry=schemas_registry).validate(pwm_specification) -def test_hdmi_specification_generation(specification_schema, hdmi_ipcores_yamls, schemas_registry): +def test_hdmi_specification_generation(specification_schema, hdmi_design, schemas_registry): """Validate generated specification for HDMI design.""" - hdmi_specification = ipcore_yamls_to_kpm_spec(hdmi_ipcores_yamls) + hdmi_specification = ipcore_yamls_to_kpm_spec([], hdmi_design) assert len(hdmi_specification["nodes"]) == HDMI_ALL_UNIQUE_NODES - Draft201909Validator(specification_schema, registry=schemas_registry).validate( - hdmi_specification - ) + Validator(specification_schema, registry=schemas_registry).validate(hdmi_specification) + + +def test_hierarchy_specification_generation( + specification_schema, hierarchy_design, schemas_registry +): + """Validate generated specification for Hierarchy design.""" + hierarchy_spec = ipcore_yamls_to_kpm_spec([], hierarchy_design) + assert len(hierarchy_spec["nodes"]) == HIERARCHY_ALL_UNIQUE_NODES + + Validator(specification_schema, registry=schemas_registry).validate(hierarchy_spec) diff --git a/tests/tests_parse/test_interface.py b/tests/tests_parse/test_interface.py index 23e3e8e1..a70e81b4 100644 --- a/tests/tests_parse/test_interface.py +++ b/tests/tests_parse/test_interface.py @@ -14,8 +14,6 @@ InterfaceDefinitionSignals, InterfaceSignalType, get_interface_by_name, - get_predefined_interfaces, - load_interface_definitions, ) @@ -68,13 +66,10 @@ def signals(self) -> NestedDict[str, Any]: }, } - def test_interfaces_presence(self): - interfaces = load_interface_definitions() - # parser returns non-empty list - assert len(interfaces) == 5 - def test_predefined(self): - assert len(get_predefined_interfaces()) == 5, "No predefined interfaces could be retrieved" + assert ( + len(InterfaceDefinition.get_builtins()) == 5 + ), "No predefined interfaces could be retrieved" def test_iface_retrieve_by_name(self): name = "AXI4Stream" diff --git a/tests/tests_parse/test_ip_desc.py b/tests/tests_parse/test_ip_desc.py index 8a145e5c..89826830 100644 --- a/tests/tests_parse/test_ip_desc.py +++ b/tests/tests_parse/test_ip_desc.py @@ -87,7 +87,7 @@ def ip_core_description(self, axi_verilog_module: VerilogModule) -> IPCoreDescri @pytest.fixture def expected_output(self) -> IPCoreDescription: - return IPCoreDescription.load(Path("tests/data/data_parse/axi_axil_adapter.yaml"), False) + return IPCoreDescription.load(Path("tests/data/data_parse/axi_axil_adapter.yaml")) @pytest.fixture def clog2_ip_core_description(self, clog2_test_module: VerilogModule) -> IPCoreDescription: @@ -95,7 +95,7 @@ def clog2_ip_core_description(self, clog2_test_module: VerilogModule) -> IPCoreD @pytest.fixture def clog2_expected_output(self) -> IPCoreDescription: - return IPCoreDescription.load(Path("tests/data/data_parse/clog2_core.yaml"), False) + return IPCoreDescription.load(Path("tests/data/data_parse/clog2_core.yaml")) @pytest.fixture def force_compliance(self): @@ -149,16 +149,10 @@ def test_builtins_compliance(self, force_compliance): IPCoreDescription.get_builtins.cache_clear() IPCoreDescription.get_builtins() - def test_load_fallback(self): - with pytest.raises(FileNotFoundError): - IPCoreDescription.load(Path("axi_interconnect.yaml"), False) - - IPCoreDescription.load(Path("axi_interconnect.yaml")) - def test_save(self, expected_output: IPCoreDescription): with tempfile.NamedTemporaryFile(suffix=".yaml") as f: expected_output.save(Path(f.name)) - loaded = IPCoreDescription.load(Path(f.name), False) + loaded = IPCoreDescription.load(Path(f.name)) assert DeepDiff(expected_output, loaded) == {} def test_invalid_syntax(self, completely_invalid_core): diff --git a/tests/update_test_data.py b/tests/update_test_data.py index 3c669d4f..bd4ddfa2 100644 --- a/tests/update_test_data.py +++ b/tests/update_test_data.py @@ -2,7 +2,7 @@ import click from tests_kpm.common import TEST_DATA_PATH, save_file_to_json -from tests_kpm.conftest import Dict, List, all_yaml_files_data, test_dirs_data +from tests_kpm.conftest import Dict, all_designs_data, test_dirs_data from topwrap.design import DesignDescription from topwrap.design_to_kpm_dataflow_parser import kpm_dataflow_from_design_descr @@ -16,23 +16,22 @@ def all_examples_designs_data() -> Dict[str, DesignDescription]: return examples -def update_dataflows( - all_yaml_files: Dict[str, List[str]], all_examples_designs: Dict[str, DesignDescription] -): - for example_name, example_design in all_examples_designs.items(): - spec = ipcore_yamls_to_kpm_spec(all_yaml_files[example_name]) - dataflow = kpm_dataflow_from_design_descr(example_design, spec) +def update_dataflows(): + test_dirs = test_dirs_data() + for example_name, design in all_designs_data().items(): + spec = ipcore_yamls_to_kpm_spec([], design) + dataflow = kpm_dataflow_from_design_descr(design, spec) save_file_to_json( - Path(TEST_DATA_PATH) / "examples" / example_name, + test_dirs[example_name], f"dataflow_{example_name}.json", dataflow, ) -def update_specifications(all_yaml_files: Dict[str, List[str]]): +def update_specifications(): test_dirs = test_dirs_data() - for example_name, yamlfiles in all_yaml_files.items(): - specification = ipcore_yamls_to_kpm_spec(yamlfiles) + for example_name, design in all_designs_data().items(): + specification = ipcore_yamls_to_kpm_spec([], design) save_file_to_json( test_dirs[example_name], f"specification_{example_name}.json", @@ -40,29 +39,6 @@ def update_specifications(all_yaml_files: Dict[str, List[str]]): ) -def update_designs(all_examples_designs: Dict[str, DesignDescription]): - def change_ips_path(design: DesignDescription, example_name: str): - ips_path = Path("topwrap/ips/") - example_path = Path(f"examples/{example_name}") - topwrap_ips = ["axi"] - - for hier_design in design.design.hierarchies.values(): - change_ips_path(hier_design, example_name) - - for design_ip in design.ips.values(): - file_path = Path(design_ip.file) - if str(file_path.parent) in topwrap_ips: - design_ip.file = str(Path(ips_path / file_path)) - else: - design_ip.file = str(Path(example_path / file_path)) - - for example_name, example_design in all_examples_designs.items(): - change_ips_path(example_design, example_name) - example_design.save( - Path(TEST_DATA_PATH) / "examples" / example_name / f"project_{example_name}.yaml" - ) - - @click.command() @click.option( "--dataflow", @@ -84,13 +60,10 @@ def change_ips_path(design: DesignDescription, example_name: str): ) def update_test_data(dataflow: bool, specification: bool, design: bool): if dataflow: - update_dataflows(all_yaml_files_data(), all_examples_designs_data()) + update_dataflows() if specification: - update_specifications(all_yaml_files_data()) - - if design: - update_designs(all_examples_designs_data()) + update_specifications() if __name__ == "__main__": diff --git a/topwrap/ips/axi/axi_axil_adapter.yaml b/topwrap/builtin/cores/axi_axil_adapter/core.yaml similarity index 100% rename from topwrap/ips/axi/axi_axil_adapter.yaml rename to topwrap/builtin/cores/axi_axil_adapter/core.yaml diff --git a/topwrap/ips/axi/axi_interconnect.yaml b/topwrap/builtin/cores/axi_interconnect/core.yaml similarity index 100% rename from topwrap/ips/axi/axi_interconnect.yaml rename to topwrap/builtin/cores/axi_interconnect/core.yaml diff --git a/topwrap/ips/axi/axi_protocol_converter.yaml b/topwrap/builtin/cores/axi_protocol_converter/core.yaml similarity index 100% rename from topwrap/ips/axi/axi_protocol_converter.yaml rename to topwrap/builtin/cores/axi_protocol_converter/core.yaml diff --git a/topwrap/ips/axi/axis_async_fifo.yaml b/topwrap/builtin/cores/axis_async_fifo/core.yaml similarity index 100% rename from topwrap/ips/axi/axis_async_fifo.yaml rename to topwrap/builtin/cores/axis_async_fifo/core.yaml diff --git a/topwrap/ips/axi/axis_dwidth_converter.yaml b/topwrap/builtin/cores/axis_dwidth_converter/core.yaml similarity index 100% rename from topwrap/ips/axi/axis_dwidth_converter.yaml rename to topwrap/builtin/cores/axis_dwidth_converter/core.yaml diff --git a/topwrap/builtin/default_config.yaml b/topwrap/builtin/default_config.yaml new file mode 100644 index 00000000..410d5324 --- /dev/null +++ b/topwrap/builtin/default_config.yaml @@ -0,0 +1,4 @@ +repositories: + builtin: file:. + +force_interface_compliance: false diff --git a/topwrap/interfaces/axi3.yaml b/topwrap/builtin/interfaces/axi3.yaml similarity index 100% rename from topwrap/interfaces/axi3.yaml rename to topwrap/builtin/interfaces/axi3.yaml diff --git a/topwrap/interfaces/axi4.yaml b/topwrap/builtin/interfaces/axi4.yaml similarity index 100% rename from topwrap/interfaces/axi4.yaml rename to topwrap/builtin/interfaces/axi4.yaml diff --git a/topwrap/interfaces/axilite.yaml b/topwrap/builtin/interfaces/axilite.yaml similarity index 100% rename from topwrap/interfaces/axilite.yaml rename to topwrap/builtin/interfaces/axilite.yaml diff --git a/topwrap/interfaces/axistream.yaml b/topwrap/builtin/interfaces/axistream.yaml similarity index 100% rename from topwrap/interfaces/axistream.yaml rename to topwrap/builtin/interfaces/axistream.yaml diff --git a/topwrap/interfaces/wishbone.yaml b/topwrap/builtin/interfaces/wishbone.yaml similarity index 100% rename from topwrap/interfaces/wishbone.yaml rename to topwrap/builtin/interfaces/wishbone.yaml diff --git a/topwrap/cli.py b/topwrap/cli.py index e361ccde..5df1d314 100644 --- a/topwrap/cli.py +++ b/topwrap/cli.py @@ -58,6 +58,12 @@ def configure_log_level(log_level: str): logger.setLevel(log_level) +def load_user_repos() -> UserRepo: + repo = UserRepo() + repo.load_repositories_from_paths(config.get_repositories_paths()) + return repo + + @main.command("build", help="Generate top module") @click.option( "--sources", @@ -100,8 +106,7 @@ def build_main( configure_log_level(log_level) config.force_interface_compliance = iface_compliance - config_user_repo = UserRepo() - config_user_repo.load_repositories_from_paths(config.get_repositories_paths()) + config_user_repo = load_user_repos() all_sources = config_user_repo.get_srcs_dirs_for_cores() all_sources.extend(sources) @@ -237,14 +242,13 @@ def run_client( ): configure_log_level(log_level) logging.info("Starting kenning pipeline manager client") - config_user_repo = UserRepo() - config_user_repo.load_repositories_from_paths(config.get_repositories_paths()) - extended_yamlfiles = config_user_repo.get_core_designs() - extended_yamlfiles += yamlfiles + config_user_repo = load_user_repos() + design_desc = DesignDescription.load(design) if design else None + spec = ipcore_yamls_to_kpm_spec( + config_user_repo.get_core_designs() + list(yamlfiles), design_desc + ) asyncio.run( - kpm_run_client( - RPCparams(host, port, extended_yamlfiles, build_dir, design), client_ready_event - ) + kpm_run_client(RPCparams(host, port, spec, build_dir, design_desc), client_ready_event) ) @@ -432,14 +436,12 @@ def topwrap_gui( default="kpm_spec.json", help="Destination file for the KPM specification", ) +@click.option("--design", "-d", type=click_r_file, help="Design YAML file") @click.argument("files", type=click_r_file, nargs=-1) -def generate_kpm_spec(output: Path, files: Tuple[Path, ...]): - config_user_repo = UserRepo() - config_user_repo.load_repositories_from_paths(config.get_repositories_paths()) - extended_yamlfiles = config_user_repo.get_core_designs() - extended_yamlfiles += files - - spec = ipcore_yamls_to_kpm_spec(extended_yamlfiles) +def generate_kpm_spec(output: Path, design: Optional[Path], files: Tuple[Path, ...]): + config_user_repo = load_user_repos() + yamls = list(files) + config_user_repo.get_core_designs() + spec = ipcore_yamls_to_kpm_spec(yamls, DesignDescription.load(design) if design else None) with open(output, "w") as f: f.write(json.dumps(spec)) @@ -455,12 +457,10 @@ def generate_kpm_spec(output: Path, files: Tuple[Path, ...]): @click.option("--design", "-d", required=True, type=click_r_file, help="Design YAML file") @click.argument("files", type=click_r_file, nargs=-1) def generate_kpm_design(output: Path, design: Path, files: Tuple[Path, ...]): - config_user_repo = UserRepo() - config_user_repo.load_repositories_from_paths(config.get_repositories_paths()) - extended_yamlfiles = config_user_repo.get_core_designs() - extended_yamlfiles += files - - spec = ipcore_yamls_to_kpm_spec(extended_yamlfiles) - dataflow = kpm_dataflow_from_design_descr(DesignDescription.load(design), spec) + config_user_repo = load_user_repos() + yamls = list(files) + config_user_repo.get_core_designs() + design_desc = DesignDescription.load(design) + spec = ipcore_yamls_to_kpm_spec(yamls, design_desc) + dataflow = kpm_dataflow_from_design_descr(design_desc, spec) with open(output, "w") as f: f.write(json.dumps(dataflow)) diff --git a/topwrap/common_serdes.py b/topwrap/common_serdes.py index ef817d03..c17e9f11 100644 --- a/topwrap/common_serdes.py +++ b/topwrap/common_serdes.py @@ -496,7 +496,8 @@ def save(self, path: Path, **kwargs: Any): with open(path, "w") as f: sch = self.Schema() sch.context[PathContext.CONTEXT_SAVE.value] = path - f.write(yaml.safe_dump(sch.dump(self), sort_keys=True, **kwargs)) + sch.context[MetaKeys.SHOULD_INLINE.value] = True + f.write(yaml.dump(sch.dump(self), Dumper=InlineYamlDumper, sort_keys=True, **kwargs)) @classmethod def load(cls, path: Path, **kwargs: Any) -> Self: diff --git a/topwrap/config.py b/topwrap/config.py index 94afddf5..381ba0d2 100644 --- a/topwrap/config.py +++ b/topwrap/config.py @@ -2,16 +2,21 @@ # SPDX-License-Identifier: Apache-2.0 import logging -from functools import cached_property import os +from functools import cached_property from pathlib import Path -from typing import List, Optional +from typing import List, Optional, Sequence import marshmallow import marshmallow_dataclass import yaml +from importlib_resources import as_file, files -from topwrap.common_serdes import MarshmallowDataclassExtensions, ext_field +from topwrap.common_serdes import ( + MarshmallowDataclassExtensions, + ResourcePathT, + ext_field, +) from topwrap.repo.user_repo import UserRepo logger = logging.getLogger(__name__) @@ -32,26 +37,12 @@ class InvalidConfigError(Exception): """Raised when the provided configuration is incorrect""" -@marshmallow_dataclass.dataclass -class RepositoryEntry: - """Contains information about topwrap repository""" - - name: str - path: str - - @cached_property - def repo(self) -> UserRepo: - repo = UserRepo() - repo.load(Path(self.path)) - return repo - - @marshmallow_dataclass.dataclass class Config(MarshmallowDataclassExtensions): """Global topwrap configuration""" force_interface_compliance: Optional[bool] = ext_field(False) - repositories: Optional[List[RepositoryEntry]] = ext_field(list) + repositories: dict[str, ResourcePathT] = ext_field(dict) kpm_build_location: str = ext_field(str(DEFAULT_SERVER_BASE_DIR)) def update(self, config: "Config"): @@ -65,27 +56,19 @@ def update(self, config: "Config"): if self.repositories is None: self.repositories = config.repositories else: - for repo in config.repositories: - if repo not in self.repositories: - self.repositories.append(repo) + self.repositories.update(config.repositories) def get_repositories_paths(self) -> List[Path]: repositories_paths = [] - if self.repositories is None: - return repositories_paths - for repository in self.repositories: - repositories_paths.append(Path(repository.path).expanduser()) + for repository in self.repositories.values(): + repositories_paths.append(repository.to_path().expanduser()) return repositories_paths - def get_repo_path_by_name(self, name: str) -> Optional[Path]: - if self.repositories is None: - return None - for repo in self.repositories: - if repo.name == name: - return Path(repo.path) - - def get_builtin_repo(self) -> RepositoryEntry: - return next(r for r in self.repositories if r.name == ConfigManager.BUILTIN_REPO_NAME) + @cached_property + def builtin_repo(self) -> UserRepo: + repo = UserRepo() + repo.load(self.repositories[ConfigManager.BUILTIN_REPO_NAME].to_path()) + return repo class ConfigManager: @@ -101,21 +84,24 @@ class ConfigManager: the ConfigManager constructor. """ + BUILTIN_REPO_NAME = "builtin" + + BUILTIN_DIR = as_file(files(f"topwrap.{BUILTIN_REPO_NAME}")) + DEFAULT_SEARCH_PATHS = [ - "topwrap.yaml", - "~/.config/topwrap/topwrap.yaml", - "~/.config/topwrap/config.yaml", + Path("topwrap.yaml"), + Path("~/.config/topwrap/topwrap.yaml"), + Path("~/.config/topwrap/config.yaml"), + BUILTIN_DIR.__enter__() / "default_config.yaml", ] - _interfaces_dir = Path("interfaces") - - def __init__(self, search_paths: Optional[List[str]] = None): + def __init__(self, search_paths: Optional[Sequence[Path]] = None): if search_paths is None: search_paths = self.DEFAULT_SEARCH_PATHS - self.search_paths = [] + self.search_paths: list[Path] = [] for path in search_paths: - self.search_paths += [Path(path).expanduser()] + self.search_paths.append(path.expanduser()) def load(self, overrides: Optional[Config] = None, default: Optional[Config] = None): config = Config() if default is None else default @@ -124,18 +110,11 @@ def load(self, overrides: Optional[Config] = None, default: Optional[Config] = N if not path.is_file(): continue - with open(path) as f: - try: - yaml_dict = yaml.safe_load(f) - except yaml.YAMLError: - logger.warning(f"{path} configuration file is not a valid YAML") - continue - try: - new_config = Config.from_dict(yaml_dict) + new_config = Config.load(path) config.update(new_config) - except marshmallow.ValidationError as e: - logger.warning(f"{path} configuration file is not valid ({e.messages})") + except (marshmallow.ValidationError, yaml.YAMLError) as e: + logger.warning(f"{path} configuration file is not valid ({e})") continue if overrides is not None: diff --git a/topwrap/design.py b/topwrap/design.py index 86ae0568..29ff6fb0 100644 --- a/topwrap/design.py +++ b/topwrap/design.py @@ -5,13 +5,17 @@ from enum import Enum from functools import cached_property from pathlib import Path -from typing import Any, ClassVar, Dict, List, Optional, Tuple, Type, Union +from typing import Any, ClassVar, Dict, Iterator, List, Optional, Tuple, Type, Union import marshmallow import marshmallow_dataclass from soc_generator.gen.wishbone_interconnect import WishboneRRInterconnect -from topwrap.common_serdes import MarshmallowDataclassExtensions, ext_field +from topwrap.common_serdes import ( + MarshmallowDataclassExtensions, + ResourcePathT, + ext_field, +) from topwrap.hdl_parsers_utils import PortDirection from topwrap.ip_desc import IPCoreDescription, IPCoreParameter @@ -24,17 +28,17 @@ class InterconnectType(Enum): wishbone_roundrobin = WishboneRRInterconnect -@marshmallow_dataclass.dataclass +@marshmallow_dataclass.dataclass(frozen=True) class DesignIP: - file: str + file: ResourcePathT - @property + @cached_property def module(self): - return IPCoreDescription.load(self.path).name + return IPCoreDescription.load(self.path) @property def path(self): - return Path(self.file) + return self.file.to_path() @marshmallow_dataclass.dataclass(frozen=True) @@ -115,6 +119,12 @@ class DesignDescription(MarshmallowDataclassExtensions): Schema: ClassVar[Type[marshmallow.Schema]] = marshmallow.Schema + @property + def all_ips(self) -> Iterator[DesignIP]: + yield from self.ips.values() + for hier in self.design.hierarchies.values(): + yield from hier.all_ips + def to_ip_connect(self, design_dir: Path = Path(".")) -> IPConnect: design_dir = Path(design_dir) ipc = IPConnect() @@ -124,12 +134,11 @@ def to_ip_connect(self, design_dir: Path = Path(".")) -> IPConnect: ipc.add_component(hier_name, hier_ipc) for ip_name, ip in self.ips.items(): - ip.file = str(design_dir / ip.path) ipc.add_component( ip_name, IPWrapper( ip.path, - ip.module, + ip.module.name, ip_name, self.design.parameters.get(ip_name, {}), ), diff --git a/topwrap/interface.py b/topwrap/interface.py index 6917d8e8..0dde0eeb 100644 --- a/topwrap/interface.py +++ b/topwrap/interface.py @@ -1,16 +1,13 @@ # Copyright (c) 2021-2024 Antmicro # SPDX-License-Identifier: Apache-2.0 -from contextlib import nullcontext from enum import Enum from functools import cached_property, lru_cache -from pathlib import Path from typing import Dict, List, Optional import marshmallow_dataclass -import yaml -from importlib_resources import as_file, files -from topwrap.util import recursive_defaultdict +from topwrap.repo.user_repo import InterfaceDescription, UserRepo +from topwrap.util import get_config, recursive_defaultdict from .common_serdes import ( MarshmallowDataclassExtensions, @@ -87,40 +84,32 @@ def optional_signals(self) -> List[IfacePortSpecification]: def required_signals(self) -> List[IfacePortSpecification]: return list(filter(lambda sig: sig.type == InterfaceSignalType.REQUIRED, self.signals.flat)) + @staticmethod + @lru_cache(maxsize=None) + def get_builtins() -> Dict[str, "InterfaceDefinition"]: + """Loads all builtin internal interfaces -def load_interface_definitions(dir_name: Optional[Path] = None): - """Load interfaces described in YAML files, bundled with the package - - :param dir_name: directory that contains YAML files for interfaces - :raises OSError: when dir_name directory cannot be listed - :return: a list of dicts that represent the yaml files - """ - - defs = [] - with ( - as_file(files("topwrap.interfaces")) if dir_name is None else nullcontext(dir_name) - ) as dir_name: - for path in dir_name.glob("**/*.yaml"): - with open(path) as f: - defs.append(yaml.safe_load(f)) - return defs + :return: a dict where keys are the interface names and values are the InterfaceDefinition objects + """ + intfs: Dict[str, InterfaceDefinition] = {} -@lru_cache(maxsize=None) -def get_predefined_interfaces() -> List[InterfaceDefinition]: - return [InterfaceDefinition.from_dict(yaml_dict) for yaml_dict in load_interface_definitions()] + repo = get_config().builtin_repo + for intf in repo.get_resources(InterfaceDescription): + intfs[intf.name] = InterfaceDefinition.load(intf.file.path) + return intfs @lru_cache(maxsize=None) def get_interfaces() -> List[InterfaceDefinition]: user_interfaces = [] - for path in config.get_interface_paths(): - user_interfaces += [ - InterfaceDefinition.from_dict(yaml_dict) - for yaml_dict in load_interface_definitions(path) - ] + for repo_entry in config.repositories.values(): + repo = UserRepo() + repo.load(repo_entry.to_path()) + for desc in repo.get_resources(InterfaceDescription): + user_interfaces.append(InterfaceDefinition.load(desc.file.path)) - return user_interfaces + get_predefined_interfaces() + return user_interfaces def get_interface_by_name(name: str) -> Optional[InterfaceDefinition]: diff --git a/topwrap/ip_desc.py b/topwrap/ip_desc.py index bf55a1e3..191f3c2e 100644 --- a/topwrap/ip_desc.py +++ b/topwrap/ip_desc.py @@ -20,9 +20,11 @@ import marshmallow import marshmallow.validate import marshmallow_dataclass -from importlib_resources import as_file, files +from typing_extensions import Self from topwrap.hdl_parsers_utils import PortDefinition, PortDirection +from topwrap.repo.user_repo import Core +from topwrap.util import get_config from .common_serdes import MarshmallowDataclassExtensions, ext_field from .config import config @@ -214,43 +216,31 @@ class IPCoreDescription(MarshmallowDataclassExtensions): Schema: ClassVar[Type[marshmallow.Schema]] + @classmethod + def from_repo_core(cls, core: Core) -> Self: + return cls.load(core.design.path) + @staticmethod @lru_cache(maxsize=None) def get_builtins() -> Dict[str, "IPCoreDescription"]: """Loads all builtin internal IP Cores - :return: a dict where keys are the IP Core file names and values are the IP Core description objects + :return: a dict where keys are the IP Core names and values are the IP Core description objects """ ips: Dict[str, IPCoreDescription] = {} - with as_file(files("topwrap.ips")) as ip_res: - for path in ip_res.glob("**/*.yaml"): - try: - ip = IPCoreDescription.load(path, False) - ips[Path(path).stem] = ip - except Exception as exc: - raise BuiltinIPCoreException( - f'Loading built-in IP core "{path.name}" failed' - ) from exc - return ips - - @classmethod - def load(cls, path: Path, fallback: bool = True, **kwargs: Any): - """Load an IP Core description yaml from the given path - :param path: the path to the .yaml file - :param fallback: if this is True and ip_path does not exist, try loading the file from the builtin directory - :return: the IP Core description object - """ + repo = get_config().builtin_repo + for core in repo.get_resources(Core): + try: + ip = IPCoreDescription.from_repo_core(core) + ips[ip.name] = ip + except Exception as exc: + raise BuiltinIPCoreException( + f'Loading built-in IP core "{core.name}" failed' + ) from exc - try: - return super().load(path, **kwargs) - except FileNotFoundError: - if fallback: - ips = cls.get_builtins() - if path.stem in ips: - return ips[path.stem] - raise + return ips def save(self, path: Optional[Path] = None, **kwargs: Any): super().save(path if path is not None else Path(self.name + ".yaml"), **kwargs) diff --git a/topwrap/kpm_common.py b/topwrap/kpm_common.py index b64a0480..b48e54c8 100644 --- a/topwrap/kpm_common.py +++ b/topwrap/kpm_common.py @@ -7,6 +7,7 @@ from pathlib import Path from typing import Dict, List, Optional, Tuple +from topwrap.design import DesignDescription from topwrap.hdl_parsers_utils import PortDirection from topwrap.util import UnreachableError @@ -40,9 +41,9 @@ class InterfaceData: class RPCparams: host: str port: int - yamlfiles: List[Path] + specification: JsonType build_dir: Path - design: Optional[Path] + design: Optional[DesignDescription] def get_all_graph_nodes(dataflow_json: JsonType) -> List[JsonType]: diff --git a/topwrap/kpm_topwrap_client.py b/topwrap/kpm_topwrap_client.py index 488373dc..9ef9abc0 100644 --- a/topwrap/kpm_topwrap_client.py +++ b/topwrap/kpm_topwrap_client.py @@ -7,7 +7,7 @@ from base64 import b64encode from datetime import datetime from pathlib import Path -from typing import Any, Dict, List, Literal, Optional, Tuple, TypedDict, Union +from typing import Any, Dict, List, Literal, Optional, TypedDict, Union import yaml from pipeline_manager_backend_communication.communication_backend import ( @@ -25,7 +25,6 @@ from .kpm_dataflow_parser import kpm_dataflow_to_design from .kpm_dataflow_validator import DataflowValidator from .util import read_json_file, save_file_to_json -from .yamls_to_kpm_spec_parser import ipcore_yamls_to_kpm_spec class RPCEndpointReturnType(TypedDict): @@ -41,7 +40,7 @@ class RPCMethods: def __init__(self, params: RPCparams, client: Optional[CommunicationBackend] = None): self.host = params.host self.port = params.port - self.yamlfiles = params.yamlfiles + self.specification = params.specification self.build_dir = params.build_dir self.design = params.design self.client = client @@ -56,8 +55,7 @@ def app_capabilities_get(self) -> Dict[Literal["stoppable_methods"], List[str]]: def specification_get(self) -> RPCEndpointReturnType: logging.info(f"Specification get request from {self.host}:{self.port}") - specification = ipcore_yamls_to_kpm_spec(self.yamlfiles) - return {"type": MessageType.OK.value, "content": specification} + return {"type": MessageType.OK.value, "content": self.specification} def dataflow_validate(self, dataflow: JsonType) -> RPCEndpointReturnType: logging.info(f"Dataflow validation request received from {self.host}:{self.port}") @@ -75,7 +73,7 @@ def dataflow_validate(self, dataflow: JsonType) -> RPCEndpointReturnType: def dataflow_run(self, dataflow: JsonType) -> RPCEndpointReturnType: logging.info(f"Dataflow run request received from {self.host}:{self.port}") - errors = _kpm_run_handler(dataflow, self.yamlfiles, self.build_dir) + errors = _kpm_dataflow_run_handler(dataflow, self.specification, self.build_dir) if errors: # note: only the first error is sent to the KPM frontend return {"type": MessageType.ERROR.value, "content": errors[0]} @@ -88,7 +86,8 @@ def dataflow_stop(self, method: str) -> RPCEndpointReturnType: def dataflow_export(self, dataflow: JsonType) -> RPCExportEndpointReturnType: logging.info(f"Dataflow export request received from {self.host}:{self.port}") - yaml_str, filename = _kpm_export_handler(dataflow, self.yamlfiles) + yaml_str = kpm_dataflow_to_design(dataflow, self.specification).to_yaml() + filename = _generate_design_filename() # content sent to KPM frontend needs to be base64 encoded, but # b64encode expects a bytes-like object as an argument therefore # the string needs to be converted to bytes first and then converted @@ -101,8 +100,11 @@ def dataflow_import( ) -> RPCEndpointReturnType: logging.info(f"Dataflow import request received from {self.host}:{self.port}") yaml_str = convert_message_to_string(external_application_dataflow, base64, mime) - dataflow = _kpm_import_handler(yaml_str, self.yamlfiles) - return {"type": MessageType.OK.value, "content": dataflow} + design_descr = DesignDescription.from_dict(yaml.safe_load(yaml_str)) + return { + "type": MessageType.OK.value, + "content": kpm_dataflow_from_design_descr(design_descr, self.specification), + } async def frontend_on_connect(self): """Gets run when frontend connects, loads initial design""" @@ -115,10 +117,11 @@ async def frontend_on_connect(self): await self.client.request("graph_change", {"dataflow": latest_dataflow}) elif self.design is not None: self.initial_load = False - with open(self.design) as design_file: - read_file = design_file.read() - dataflow = _kpm_import_handler(read_file, self.yamlfiles) - await self.client.request("graph_change", {"dataflow": dataflow}) + dataflow = kpm_dataflow_from_design_descr(self.design, self.specification) + if self.client is None: + logging.debug("The client to send request to is not defined") + return + await self.client.request("graph_change", {"dataflow": dataflow}) async def nodes_on_change(self, **kwargs: Any): await _kpm_handle_graph_change(self) @@ -144,24 +147,13 @@ async def _kpm_handle_graph_change(rpc_object: RPCMethods): ) -def _kpm_import_handler(data: str, yamlfiles: List[Path]) -> JsonType: - specification = ipcore_yamls_to_kpm_spec(yamlfiles) - design_descr = DesignDescription.from_dict(yaml.safe_load(data)) - return kpm_dataflow_from_design_descr(design_descr, specification) - - -def _design_from_kpm_data(data: JsonType, yamlfiles: List[Path]) -> DesignDescription: - specification = ipcore_yamls_to_kpm_spec(yamlfiles) - return kpm_dataflow_to_design(data, specification) - - -def _kpm_run_handler(data: JsonType, yamlfiles: List[Path], build_dir: Path) -> List[str]: +def _kpm_dataflow_run_handler(data: JsonType, spec: JsonType, build_dir: Path) -> list: """Parse information about design from KPM dataflow format into Topwrap's internal representation and build the design. """ messages = DataflowValidator(data).validate_kpm_design() if not messages["errors"]: - design = _design_from_kpm_data(data, yamlfiles) + design = kpm_dataflow_to_design(data, spec) name = design.design.name or "top" ipc = design.to_ip_connect() ipc.generate_top(name, build_dir) @@ -176,20 +168,6 @@ def _generate_design_filename() -> str: return datetime.now().strftime("kpm_design_%Y%m%d_%H%M%S.yaml") -def _kpm_export_handler(dataflow: JsonType, yamlfiles: List[Path]) -> Tuple[str, str]: - """Convert created dataflow into Topwrap's design description YAML. - - :param dataflow: dataflow JSON from KPM - :param yamlfiles: additional YAML files containing IP core descriptions - - :return: pair: converted YAML string, automatically generated filename - with current timestamp - """ - filename = _generate_design_filename() - design = _design_from_kpm_data(dataflow, yamlfiles) - return design.to_yaml(), filename - - async def kpm_run_client( rpc_params: RPCparams, client_ready_event: Optional[threading.Event] = None ): diff --git a/topwrap/yamls_to_kpm_spec_parser.py b/topwrap/yamls_to_kpm_spec_parser.py index 03f6b83f..149ba5d6 100644 --- a/topwrap/yamls_to_kpm_spec_parser.py +++ b/topwrap/yamls_to_kpm_spec_parser.py @@ -4,10 +4,11 @@ from dataclasses import dataclass from enum import Enum from pathlib import Path -from typing import Dict, List, Optional +from typing import Collection, Dict, List, Optional from pipeline_manager.specification_builder import SpecificationBuilder +from topwrap.design import DesignDescription from topwrap.design_to_kpm_dataflow_parser import ( KPMDataflowExternalMetanode, KPMDataflowMetanodeInterface, @@ -20,6 +21,7 @@ IPCoreParameter, IPCorePorts, ) +from topwrap.resource_field import FileHandler, ResourceReferenceHandler from .interface import InterfaceMode from .kpm_common import ( @@ -182,9 +184,9 @@ def _ipcore_ifaces_to_iface_type(ifaces: Dict[str, IPCoreInterface]) -> List[Int return iface_list -def create_core_node_from_yaml(yamlfile: Path) -> NodeType: +def create_core_node_from_yaml(res: ResourceReferenceHandler) -> NodeType: """Returns single KPM specification 'node' representing given IP core description YAML file""" - ip_yaml = IPCoreDescription.load(Path(yamlfile)) + ip_yaml = IPCoreDescription.load(res.to_path()) ip_name = ip_yaml.name ip_props = _ipcore_params_to_prop_type(ip_yaml.parameters) @@ -192,7 +194,7 @@ def create_core_node_from_yaml(yamlfile: Path) -> NodeType: ip_ifaces = _ipcore_ifaces_to_iface_type(ip_yaml.interfaces) return NodeType( - ip_name, "IPcore", LayerType.IP_CORE, ip_props, ip_ports + ip_ifaces, str(yamlfile) + ip_name, "IPcore", LayerType.IP_CORE, ip_props, ip_ports + ip_ifaces, res.to_str() ) @@ -297,17 +299,18 @@ def add_metadata_to_specification( ) -def generate_spec_using_builder(yamlfiles: List[Path]) -> JsonType: +def generate_spec_using_builder(resources: Collection[ResourceReferenceHandler]) -> JsonType: """Build specification based on yamlfiles using SpecificationBuilder API""" specification_builder = SpecificationBuilder(spec_version=SPECIFICATION_VERSION) - for yamlfile in yamlfiles: - core_data = create_core_node_from_yaml(yamlfile) + for res in resources: + core_data = create_core_node_from_yaml(res) add_node_type_to_specification(specification_builder, core_data) interfaces_types = _get_ifaces_types( - specification_builder._construct_specification(sort_spec=False) + specification_builder._construct_specification(sort_spec=True) ) + interfaces_types.sort() for ext_name in KPMDataflowExternalMetanode.interface_dir_by_node_name.keys(): ex_metanode = create_external_metanode(ext_name, interfaces_types) @@ -321,21 +324,34 @@ def generate_spec_using_builder(yamlfiles: List[Path]) -> JsonType: add_metadata_to_specification(specification_builder, interfaces_types) - return specification_builder._construct_specification(sort_spec=False) + return specification_builder._construct_specification(sort_spec=True) -def ipcore_yamls_to_kpm_spec(yamlfiles: List[Path]) -> JsonType: +def ipcore_yamls_to_kpm_spec( + yamlfiles: Collection[Path], design: Optional[DesignDescription] = None +) -> JsonType: """Translate Topwrap's IP core description YAMLs into KPM specification 'nodes'. :param yamlfiles: IP core description YAMLs, that will be converted into KPM specification 'nodes' + :param design: A DesignDescription with IP Core references that + will get added to the generated specification + :return: a dict containing KPM specification in which each 'node' represents a separate IP core """ - specification = generate_spec_using_builder(yamlfiles) + resources: set[ResourceReferenceHandler] = {FileHandler(path) for path in yamlfiles} + paths = set(yamlfiles) + if design is not None: + for ip in design.all_ips: + if ip.file.to_path() not in paths: + paths.add(ip.file.to_path()) + resources.add(ip.file) + + specification = generate_spec_using_builder(resources) _duplicate_ipcore_types_check(specification)