Skip to content

Commit f666df1

Browse files
committed
Standardize the log output
1 parent 3aab525 commit f666df1

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,24 @@ Enter the test cycle:
141141

142142
`projects/soc`目录下存放了接入`ysyxSoC`的示例程序。源码中只有一个占位符,能够通过编译但不能正常运行。
143143

144-
使用该脚本,需要先按照 [ysyx SoC 的 readme](https://github.com/osCPU/ysyxsoc) 完成命名规范和 CPU 内部修改两个步骤,得到 `ysyx_21xxxx.v`,随后放入 `projects/soc/vsrc/` 中。脚本会根据 `myinfo.txt` 中的 ID 自动进行 `cpu-check``soc` 的编译。
145-
146-
`ysyxSoC` 中附带的例程会被自动软连接至 `build` 目录下,仿真时可以如下快速使用。
144+
要使用该框架,需要先按照 [ysyx SoC 的 readme](https://github.com/osCPU/ysyxsoc) 完成 `命名规范``CPU 内部修改` 两个步骤,得到 `ysyx_21xxxx.v`,随后放入 `projects/soc/vsrc/` 中。此后,执行下面的命令将会根据 `myinfo.txt` 中的 ID 自动 对代码进行规范检查、集成到 `soc` 并运行指定的程序。`ysyxSoC` 中附带的例程会被自动软连接至 `build` 目录下,仿真时可以快速使用。
147145

148146
```bash
149147
./build.sh -e soc -b -s -y -v '--timescale "1ns/1ns" -Wno-fatal --trace' -a "-i ysyxSoC/flash/hello-flash.bin --dump-wave"
150148
```
151149

150+
由于无法直接使用 `difftest` 框架,暂时只支持少量参数。
151+
```bash
152+
$ ./emu -h
153+
Usage: ./emu [OPTION...]
154+
155+
-i, --image=FILE run with this image file
156+
--dump-wave dump waveform when log is enabled
157+
-b, --log-begin=NUM display log from NUM th cycle
158+
-e, --log-end=NUM stop display log at NUM th cycle
159+
-h, --help print program help info
160+
```
161+
152162
## 查看波形
153163

154164
`oscpu`目录下使用命令可以通过`gtkwave`查看输出的波形,其中`xxx`表示例程名。

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ build_soc_proj() {
121121
mkdir -p $BUILD_PATH/vsrc $BUILD_PATH/csrc
122122

123123
if [[ ! -f "$PROJECT_PATH/$VSRC_FOLDER/ysyx_${ID:0-6}.v" ]]; then
124-
echo "$PROJECT_PATH/$VSRC_FOLDER/ysyx_${ID:0-6}.v not detected. Failed to compile with ysyxSoC."
124+
echo "$VSRC_FOLDER/ysyx_${ID:0-6}.v not detected. Please follow the README of ysyxSoC to get this file."
125125
exit 1
126126
fi
127127

projects/soc/csrc/emu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ class Emulator
1919

2020
if (args.image == nullptr)
2121
throw "Image file unspecified. Use -i to provide the image of flash";
22+
printf("Initializing flash with \"%s\" ...\n", args.image);
2223
flash_init(args.image);
23-
printf("Flash initialized with \"%s\"\n", args.image);
2424

25-
printf("Initializing DUT...\n");
25+
printf("Initializing and resetting DUT ...\n");
2626
dut_ptr = new VysyxSoCFull;
2727
dut_ptr->reset = 1;
2828
for (int i = 0; i < 10; i++)

projects/soc/csrc/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void sig_handler(int signo)
1515
puts("SIGINT received, forcely shutting down.\n");
1616
_exit(0);
1717
}
18-
puts("SIGINT received, gracefully shutting down...\n");
18+
puts("SIGINT received, gracefully shutting down... Type Ctrl+C again to stop forcely.\n");
1919
signal_received = signo;
2020
}
2121

@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
3737
atexit(release);
3838

3939
emu = new Emulator(argc, argv);
40+
printf("Start simulating ...\n");
4041
while (!Verilated::gotFinish() && signal_received == 0)
4142
{
4243
emu->step();

0 commit comments

Comments
 (0)