Skip to content

Commit 4cee0db

Browse files
authored
feat: non-interactive mode support
1 parent 4cd9e9d commit 4cee0db

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
run: sudo -E apt-get -y install iverilog gtkwave
2020
- name: Run TestBench
2121
run: make
22+
env:
23+
DEBIAN_FRONTEND: noninteractive
2224
- name: Upload simulation results
2325
uses: actions/upload-artifact@v4
2426
if: always()
@@ -29,3 +31,4 @@ jobs:
2931
**/*.vvp
3032
**/*.vcd
3133
**/*.out
34+
retention-days: 7

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ NODE := node
1111
RM := rm -rf
1212

1313
# Flags
14+
ifeq ($(DEBIAN_FRONTEND),noninteractive)
1415
VVP_FLAGS := -n
16+
else
17+
VVP_FLAGS :=
18+
endif
1519

1620
# Color output
1721
BLUE := \033[34m
@@ -24,11 +28,11 @@ RESET := \033[0m
2428
.SECONDARY:
2529

2630
# Default target: transform and test
27-
all: inst test
31+
all: inst $(TOP_VERILOG_FILE)
2832

2933
# Transform instruction file only
3034
inst:
31-
@echo "$(CYAN)Analyzing instruction file...$(RESET)"
35+
@echo "$(BLUE)Analyzing and Transforming $(CYAN)$(INST_ASM_FILE)$(BLUE) ...$(RESET)"
3236
@$(NODE) transform.js $(INST_ASM_FILE)
3337

3438
# Run test only
@@ -42,12 +46,12 @@ clean:
4246
# Help target
4347
help:
4448
@echo "Usage:"
45-
@echo " make - Transform instruction file and run test"
46-
@echo " make help - Show this help message"
47-
@echo " make inst - Analyze instruction file only"
48-
@echo " make test - Run test only"
49-
@echo " make clean - Remove build artifacts (*.vvp, *.vcd, *.out)"
50-
@echo " make <file> - Simulate specified verilog file"
49+
@echo " make - Transform instruction file and run test"
50+
@echo " make help - Show this help message"
51+
@echo " make inst - Analyze and transform instruction file only"
52+
@echo " make test - Run test only"
53+
@echo " make clean - Remove build artifacts (*.vvp, *.vcd, *.out)"
54+
@echo " make <file> - Simulate specified verilog file"
5155
@echo " <file>.vvp"
5256

5357
%.vvp:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ Run `make test` to simulate the CPU. If the wave cannot meet the needs, modify t
103103

104104
For example, you can modify `N_CLOCKS` to `10'd100` to simulate the CPU per 100 clocks, then enter `cont` in the terminal prompt to continue next 100 clocks of simulation.
105105

106-
You can modify `N_OPERATE` to `$finish` to finish and exit the simulation after N_CLOCKS clocks. In [vvp flags](https://steveicarus.github.io/iverilog/usage/vvp_flags.html), option `-n` means `non-interactive ($stop = $finish)`, you can also comment the following line in [Makefile](Makefile).
106+
You can modify `N_OPERATE` to `$finish` to finish and exit the simulation after N_CLOCKS clocks. Or you can set environment variable `DEBIAN_FRONTEND=noninteractive` to add `-n` to [VVP_FLAGS](https://steveicarus.github.io/iverilog/usage/vvp_flags.html), which means `non-interactive ($stop = $finish)`. For example:
107107

108108
```shell
109-
VVP_FLAGS := -n
109+
DEBIAN_FRONTEND=noninteractive make
110110
```
111111

112112
## Hardware Testing

0 commit comments

Comments
 (0)