efabless / caravel_user_project

https://caravel-user-project.readthedocs.io
Apache License 2.0
186 stars 329 forks source link

Error in make setup: setup-cocotb-env is not run using venv-cocotb python #370

Open bman12three4 opened 3 months ago

bman12three4 commented 3 months ago

I believe this is the fix:

diff --git a/Makefile b/Makefile
index 8bbd1b6..0de8a89 100644
--- a/Makefile
+++ b/Makefile
@@ -349,7 +349,7 @@ install-caravel-cocotb:

 .PHONY: setup-cocotb-env
 setup-cocotb-env:
-       @(python3 $(PROJECT_ROOT)/verilog/dv/setup-cocotb.py $(CARAVEL_ROOT) $(MCW_ROOT) $(PDK_ROOT) $(PDK) $(PROJECT_ROOT))
+       @(./venv-cocotb/bin/$(PYTHON_BIN) $(PROJECT_ROOT)/verilog/dv/setup-cocotb.py $(CARAVEL_ROOT) $(MCW_ROOT) $(PDK_ROOT) $(PDK) $(PROJECT_ROOT))

 .PHONY: setup-cocotb
 setup-cocotb: install-caravel-cocotb setup-cocotb-env simenv-cocotb
d-m-bailey commented 2 months ago

@bman12three4 good catch!

I'm thinking the solution might be to activate the virtual enviroment within the Makefile.

*** 338,349 ****
  install-caravel-cocotb:
        rm -rf ./venv-cocotb
        $(PYTHON_BIN) -m venv ./venv-cocotb
!       ./venv-cocotb/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir pip
!       ./venv-cocotb/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir caravel-cocotb

  .PHONY: setup-cocotb-env
  setup-cocotb-env:
!       @(python3 $(PROJECT_ROOT)/verilog/dv/setup-cocotb.py $(CARAVEL_ROOT) $(MCW_ROOT) $(PDK_ROOT) $(PDK) $(PROJECT_ROOT))

  .PHONY: setup-cocotb
  setup-cocotb: install-caravel-cocotb setup-cocotb-env simenv-cocotb
--- 338,351 ----
  install-caravel-cocotb:
        rm -rf ./venv-cocotb
        $(PYTHON_BIN) -m venv ./venv-cocotb
!       . ./venv-cocotb/bin/activate && \
!       $(PYTHON_BIN) -m pip install --upgrade --no-cache-dir pip && \
!       $(PYTHON_BIN) -m pip install --upgrade --no-cache-dir caravel-cocotb

  .PHONY: setup-cocotb-env
  setup-cocotb-env:
!       @(. ./venv-cocotb/bin/activate && \
!       python3 $(PROJECT_ROOT)/verilog/dv/setup-cocotb.py $(CARAVEL_ROOT) $(MCW_ROOT) $(PDK_ROOT) $(PDK) $(PROJECT_ROOT))

  .PHONY: setup-cocotb
  setup-cocotb: install-caravel-cocotb setup-cocotb-env simenv-cocotb