From 72867a7a37fab33cd1b177606e5a002ccc12815a Mon Sep 17 00:00:00 2001 From: Piotr Binkowski Date: Fri, 17 Sep 2021 14:53:09 +0200 Subject: [PATCH 1/7] Use updated LiteSPI core Signed-off-by: Piotr Binkowski --- soc/hps_soc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/soc/hps_soc.py b/soc/hps_soc.py index 3cdd915e7..d685d901b 100755 --- a/soc/hps_soc.py +++ b/soc/hps_soc.py @@ -161,7 +161,9 @@ def setup_litespi_flash(self): self.submodules.spiflash_phy = LiteSPIPHY( self.platform.request("spiflash4x"), GD25LQ128D(Codes.READ_1_1_4), - default_divisor=0) + default_divisor=1, + rate="1:2", + extra_latency=1) self.submodules.spiflash_mmap = LiteSPI(phy=self.spiflash_phy, mmap_endianness = self.cpu.endianness) self.csr.add("spiflash_mmap") From 7dc55632c1a8d3c8dbf8f4015f1419624926ebed Mon Sep 17 00:00:00 2001 From: Piotr Binkowski Date: Wed, 22 Sep 2021 12:47:04 +0200 Subject: [PATCH 2/7] common/Makefile: sort find output Signed-off-by: Piotr Binkowski --- common/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/Makefile b/common/Makefile index 7c8bf582d..fcfc2a58b 100644 --- a/common/Makefile +++ b/common/Makefile @@ -116,7 +116,7 @@ LFLAGS := \ -Wl,--build-id=none -find_srcs = $(shell find $(SRC_DIR) -name \*.$(1)) +find_srcs = $(shell find $(SRC_DIR) -name \*.$(1) | LC_ALL=C sort) CSOURCES := $(call find_srcs,c) CPPSOURCES := $(call find_srcs,cpp) CCSOURCES := $(call find_srcs,cc) @@ -195,4 +195,4 @@ $(OBJECTS): | $(MODEL_INCS) $(DATA_INCS) $(QUIET) echo " AS $(notdir $<) $(notdir $@)" $(QUIET) $(CC) -x assembler-with-cpp -c $< $(CFLAGS) -o $@ -MMD -include $(shell find src -name *.d) +include $(call find_srcs,d) From 6511914669edb8f2ba318320564f091f6a2c3d51 Mon Sep 17 00:00:00 2001 From: Piotr Binkowski Date: Thu, 23 Sep 2021 15:52:57 +0200 Subject: [PATCH 3/7] nextpnr: JSON timing reports Signed-off-by: Piotr Binkowski --- scripts/nextpnr-timing.py | 37 ++++++++++++++++++++++++++++++++++ scripts/parallel-nextpnr-nexus | 3 +++ 2 files changed, 40 insertions(+) create mode 100755 scripts/nextpnr-timing.py diff --git a/scripts/nextpnr-timing.py b/scripts/nextpnr-timing.py new file mode 100755 index 000000000..e4c67829e --- /dev/null +++ b/scripts/nextpnr-timing.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 + +import json +import argparse + +arg = argparse.ArgumentParser() + +arg.add_argument('file', help='JSON timing report') +arg.add_argument('--src', default='', help='Source name') +arg.add_argument('--dst', default='', help='Destination name') +arg.add_argument('--results', default=100, type=int, help='Number of paths reported') +arg.add_argument('--tgt-len', default=0.0, type=float, help='List paths that are longer than this value (in ns)') + +args = vars(arg.parse_args()) + +data = dict() + +with open(args['file'], 'r') as file: + data = json.load(file) + +paths = [] + +for net in data['detailed_net_timings']: + if args['src'] in net['driver']: + src = net['driver'] + for endpoint in net['endpoints']: + if args['dst'] in endpoint['cell']: + dly = endpoint['delay'] + tgt = endpoint['cell'] + if args['tgt_len'] < dly: + paths.append((src, tgt, dly)) + +paths.sort(key=lambda tup: tup[2], reverse=True) + +for path in paths[:args['results']]: + src, tgt, dly = path + print(f"{src} -> {tgt} : {dly}") diff --git a/scripts/parallel-nextpnr-nexus b/scripts/parallel-nextpnr-nexus index 0866b285a..174c38f0e 100755 --- a/scripts/parallel-nextpnr-nexus +++ b/scripts/parallel-nextpnr-nexus @@ -62,6 +62,8 @@ for s in $(seq ${SEED_COUNT}); do --pdc "${PDC}" \ --fasm "${DIR}/output.fasm" \ --device LIFCL-17-8UWG72C \ + --report="${DIR}/report.json" \ + --detailed-timing-report \ --seed "${seed}" 2>&1 | \ (while read line; do echo "$(date +%H:%M:%S) ${line}"; done @@ -95,6 +97,7 @@ while [[ ${#CHILD_PIDS} -gt 1 ]]; do echo "SUCCESS: nextpnr with seed=${seed}" cp "runs/seed-${seed}/output.fasm" $RESULT_FASM cp "runs/seed-${seed}/nextpnr-nexus.log" nextpnr-nexus.log + cp "runs/seed-${seed}/report.json" report.json # TODO: find a more elegant solution for halting all children for p in "${CHILD_PIDS[@]}"; do pkill -P $p; done exit 0 From 85fc8d0cecf03373440ee169957904d9f4355521 Mon Sep 17 00:00:00 2001 From: Piotr Binkowski Date: Tue, 28 Sep 2021 13:19:23 +0200 Subject: [PATCH 4/7] Use slim+cfu CPU Signed-off-by: Piotr Binkowski --- proj/hps_accel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/proj/hps_accel/Makefile b/proj/hps_accel/Makefile index 1cf415242..9cec3496c 100644 --- a/proj/hps_accel/Makefile +++ b/proj/hps_accel/Makefile @@ -61,6 +61,7 @@ TEST_MENU_ITEMS=3 q # Customise arguments to Litex: export EXTRA_LITEX_ARGS +EXTRA_LITEX_ARGS += --cpu-variant=slim+cfu ifeq '$(TARGET)' 'digilent_arty' # Cannot meet timing at 100MHz, reduce to 75MHz EXTRA_LITEX_ARGS += --sys-clk-freq 75000000 From 8df3f64cef442b4b6388aeb6c51e75332ca17759 Mon Sep 17 00:00:00 2001 From: Piotr Binkowski Date: Wed, 29 Sep 2021 16:54:19 +0200 Subject: [PATCH 5/7] cfu: generate rsp_valid without using cmd_valid Signed-off-by: Piotr Binkowski --- python/nmigen_cfu/cfu.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/nmigen_cfu/cfu.py b/python/nmigen_cfu/cfu.py index 14807b475..f472d1fa3 100644 --- a/python/nmigen_cfu/cfu.py +++ b/python/nmigen_cfu/cfu.py @@ -259,7 +259,9 @@ def check_instruction_done(): m.d.sync += stored_function_id.eq( self.cmd_function_id[:3]) m.d.comb += instruction_starts[current_function_id].eq(1) - check_instruction_done() + m.d.sync += stored_output.eq( + instruction_outputs[current_function_id]) + m.next = "WAIT_INSTRUCTION" with m.State("WAIT_INSTRUCTION"): # An instruction is executing on the CFU. We're waiting until it # completes. From 7367e76498313649611896b6fa6540e8afe09159 Mon Sep 17 00:00:00 2001 From: Piotr Binkowski Date: Tue, 5 Oct 2021 13:20:40 +0200 Subject: [PATCH 6/7] hps: set clock to 64MHz Signed-off-by: Piotr Binkowski --- soc/hps_proto2_platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soc/hps_proto2_platform.py b/soc/hps_proto2_platform.py index 8f080151b..180e3f444 100644 --- a/soc/hps_proto2_platform.py +++ b/soc/hps_proto2_platform.py @@ -94,7 +94,7 @@ def __init__(self, platform, sys_clk_freq): class Platform(LatticePlatform): # The NX-17 has a 450 MHz oscillator. Our system clock should be a divisor # of that. - clk_divisor = 12 + clk_divisor = 7 sys_clk_freq = int(450e6 / clk_divisor) def __init__(self, toolchain="radiant", parallel_pnr=True): From 23b8307ef0b893b6b0daf3c93a4719934773c89c Mon Sep 17 00:00:00 2001 From: Piotr Binkowski Date: Tue, 5 Oct 2021 13:20:59 +0200 Subject: [PATCH 7/7] hps: disable abc9 Signed-off-by: Piotr Binkowski --- soc/hps.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/soc/hps.mk b/soc/hps.mk index 6f74c1d79..056a6997b 100644 --- a/soc/hps.mk +++ b/soc/hps.mk @@ -38,8 +38,6 @@ OUT_DIR:= build/$(SOC_NAME) LITEX_ARGS= --output-dir $(OUT_DIR) \ --csr-json $(OUT_DIR)/csr.json $(CFU_ARGS) $(EXTRA_LITEX_ARGS) -# Open source toolchain (Yosys + Nextpnr) is used by default -LITEX_ARGS += --yosys-abc9 ifndef IGNORE_TIMING LITEX_ARGS += --nextpnr-timingstrict endif