Skip to content

Commit e788fd6

Browse files
author
An Zhong
committed
Fix local bootstrap and DISC CPU compatibility
1 parent 3b4b7eb commit e788fd6

File tree

7 files changed

+158
-112
lines changed

7 files changed

+158
-112
lines changed

python/assassyn/codegen/verilog/top.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def _attach_external_values(module, port_map, handled_ports):
546546

547547
dumper.append_code(
548548
f"{mod_name}_trigger_counter_delta.assign("
549-
f"{summed_triggers}.as_bits()[0:{width}])"
549+
f"{summed_triggers}.as_bits().pad_or_truncate({width}))"
550550
)
551551
else:
552552
dumper.append_code(

scripts/init/circt.inc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44
.PHONY: install-circt clean-circt patch-circt build-pycde-source verify-pycde-installation check-wheel-exists install-pycde-wheel
55

66
# Patch target for circt
7-
patch-circt: 3rd-party/circt/.patch-applied
8-
9-
# Marker file to track patch application
10-
3rd-party/circt/.patch-applied:
7+
patch-circt:
118
@echo "Checking circt patch status..."
129
@cd 3rd-party/circt && \
1310
if bash ../../scripts/patch-apply.sh check ../../scripts/init/patches/circt.patch 2>/dev/null; then \
1411
echo "CIRCT patch already applied — skipping patch step."; \
1512
else \
1613
echo "Applying CIRCT patch..."; \
1714
bash ../../scripts/patch-apply.sh apply ../../scripts/init/patches/circt.patch; \
18-
fi && \
19-
touch $(CURDIR)/3rd-party/circt/.patch-applied
15+
fi
2016

2117
install-circt: install-py-package 3rd-party/circt/.circt-built
2218

@@ -40,6 +36,10 @@ verify-pycde-installation:
4036
# Check if wheel exists
4137
check-wheel-exists:
4238
@if [ ! -d "3rd-party/circt/frontends/PyCDE/dist" ] || [ -z "$$(ls 3rd-party/circt/frontends/PyCDE/dist/*.whl 2>/dev/null)" ]; then \
39+
if [ ! -f "3rd-party/circt/llvm/llvm/CMakeLists.txt" ]; then \
40+
echo "Missing 3rd-party/circt/llvm checkout. Run 'git submodule update --init --recursive' and retry." >&2; \
41+
exit 1; \
42+
fi; \
4343
echo "No wheel found, building PyCDE from source..."; \
4444
$(MAKE) build-pycde-source; \
4545
fi

scripts/init/patches/circt.patch

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
frontends/PyCDE/setup.py
22
- cmake_args += ["-DESI_RUNTIME=ON"]
3-
+ cmake_args += ["-DESI_RUNTIME=OFF"]
3+
+ # Assassyn disables ESI runtime for local PyCDE builds.
4+
+ cmake_args += ["-DESI_RUNTIME=OFF"]
5+
- targets = ["check-pycde"]
6+
+ # Assassyn skips upstream PyCDE self-tests during local bootstrap.
7+
+ targets = ["install-PyCDE"]

scripts/init/py-package.inc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
# Python package installation targets
22
# Converted from scripts/init/py-package.sh
33

4+
PYTHON_VENV_BIN ?= $(shell command -v python3.12 2>/dev/null || command -v python3 2>/dev/null || command -v python 2>/dev/null)
5+
46
.PHONY: install-py-package clean-python
57

68
install-py-package:
79
@echo "Setting up Python virtual environment..."
10+
@if [ -z "$(PYTHON_VENV_BIN)" ]; then \
11+
echo "No suitable Python interpreter found. Tried python3.12, python3, and python." >&2; \
12+
exit 1; \
13+
fi
814
@if [ ! -d "$(VENV_DIR)" ]; then \
9-
echo "Creating virtual environment..."; \
10-
python -m venv $(VENV_DIR); \
15+
echo "Creating virtual environment with $(PYTHON_VENV_BIN)..."; \
16+
"$(PYTHON_VENV_BIN)" -m venv $(VENV_DIR); \
1117
else \
1218
echo "Virtual environment already exists."; \
1319
fi
1420
@echo "Installing dependencies using virtual environment Python..."
15-
@. $(VENV_DIR)/bin/activate && pip install --upgrade pip
16-
@. $(VENV_DIR)/bin/activate && pip install build
17-
@. $(VENV_DIR)/bin/activate && pip install -r python/requirements.txt
21+
@$(VENV_DIR)/bin/python -m pip install --upgrade pip
22+
@$(VENV_DIR)/bin/python -m pip install build
23+
@$(VENV_DIR)/bin/python -m pip install -r python/requirements.txt
1824
@echo "Python dependencies installed successfully in virtual environment."
1925

2026
clean-python:

scripts/init/wrapper.inc

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,51 @@
44
.PHONY: build-ramulator2 build-wrapper clean-ramulator2 clean-wrapper patch-ramulator2
55

66
# Patch target for ramulator2
7-
patch-ramulator2: 3rd-party/ramulator2/.patch-applied
8-
9-
# Marker file to track patch application
10-
3rd-party/ramulator2/.patch-applied:
7+
patch-ramulator2:
118
@echo "Checking ramulator2 patch status..."
129
@cd 3rd-party/ramulator2 && \
1310
if bash ../../scripts/patch-apply.sh check ../../scripts/init/patches/ramulator2.patch 2>/dev/null; then \
1411
echo "Ramulator2 patch already applied — skipping patch step."; \
1512
else \
1613
echo "Applying ramulator2 patch..."; \
1714
bash ../../scripts/patch-apply.sh apply ../../scripts/init/patches/ramulator2.patch; \
18-
fi && \
19-
touch $(CURDIR)/3rd-party/ramulator2/.patch-applied
15+
fi
2016

21-
build-ramulator2: 3rd-party/ramulator2/.ramulator2-built
17+
build-ramulator2: patch-ramulator2 3rd-party/ramulator2/.ramulator2-built
2218

2319
# Marker file to track build completion
24-
3rd-party/ramulator2/.ramulator2-built: patch-ramulator2
25-
@if [ -f "$@" ]; then \
20+
3rd-party/ramulator2/.ramulator2-built:
21+
@if [ -f "$@" ] && ls 3rd-party/ramulator2/libramulator.* >/dev/null 2>&1; then \
2622
echo "Ramulator2 already built — skipping build step."; \
2723
else \
28-
echo "Building Ramulator2..."; \
29-
echo "Step 1: Creating build directory..."; \
30-
mkdir -p 3rd-party/ramulator2/build; \
31-
echo "Step 2: Running CMake configuration..."; \
32-
cmake -B 3rd-party/ramulator2/build -S 3rd-party/ramulator2 -DCMAKE_POLICY_VERSION_MINIMUM=3.5; \
33-
echo "Step 3: Building with make..."; \
34-
make -C 3rd-party/ramulator2/build -j; \
35-
echo "Ramulator2 build completed."; \
24+
rm -f $(CURDIR)/$@; \
25+
echo "Building Ramulator2..." && \
26+
echo "Step 1: Creating build directory..." && \
27+
mkdir -p 3rd-party/ramulator2/build && \
28+
echo "Step 2: Running CMake configuration..." && \
29+
cmake -B 3rd-party/ramulator2/build -S 3rd-party/ramulator2 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 && \
30+
echo "Step 3: Building with make..." && \
31+
$(MAKE) -C 3rd-party/ramulator2/build -j && \
32+
ls 3rd-party/ramulator2/libramulator.* >/dev/null 2>&1 && \
33+
echo "Ramulator2 build completed." && \
3634
touch $(CURDIR)/$@; \
3735
fi
3836

3937
build-wrapper: tools/c-ramulator2-wrapper/.wrapper-built
4038

4139
# Marker file to track wrapper build completion
4240
tools/c-ramulator2-wrapper/.wrapper-built: build-ramulator2
43-
@if [ -f "$@" ]; then \
41+
@if [ -f "$@" ] && ls tools/c-ramulator2-wrapper/build/lib/libwrapper.* >/dev/null 2>&1; then \
4442
echo "Wrapper already built — skipping build step."; \
4543
else \
46-
echo "Building Wrapper..."; \
44+
rm -f $(CURDIR)/$@; \
45+
echo "Building Wrapper..." && \
4746
mkdir -p tools/c-ramulator2-wrapper/build && \
4847
cd tools/c-ramulator2-wrapper/build && \
4948
cmake .. && \
50-
make -j; \
51-
echo "Wrapper build completed."; \
49+
$(MAKE) -j && \
50+
ls lib/libwrapper.* >/dev/null 2>&1 && \
51+
echo "Wrapper build completed." && \
5252
touch $(CURDIR)/$@; \
5353
fi
5454

0 commit comments

Comments
 (0)