Skip to content

Commit b900c24

Browse files
committed
Code upload function is supported
1 parent 34d380f commit b900c24

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ Usage: ./emu [OPTION...]
187187

188188
通过测试的用例,将打印`PASS`。测试失败的用例,打印`FAIL`并生成对应的log文件,可以查看log文件来调试,也可以另外开启波形输出来调试。
189189

190+
# 程序上传
191+
192+
在本框架中接入`ysyxSoC` 并完成所有测试后,可以开始代码上传流程。**上传前请确保所有触发器可复位。**
193+
194+
1. 创建自己的开源`git仓库`,不局限于`github`
195+
2.`Verilator中Warning无法清理说明.xlsx`文件放置于`submit`目录下。
196+
3. 制作一份带数据流向的处理器架构图,并对图中各模块做简单说明,整理成`ysyx_21xxxx.v.pdf`文件并放置于`submit`目录下。
197+
4. 进入`oscpu`目录下,运行`./submit.sh`,根据提示完成代码上传操作。
198+
5. 将自己仓库的`URL`发送给组内助教。
199+
190200
# 扩展
191201

192202
[一生一芯官网](https://oscpu.github.io/ysyx/)

submit.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/bash
2+
3+
get_id() {
4+
# Get id and name
5+
ID=`sed '/^ID=/!d;s/.*=//' $MYINFO_FILE`
6+
NAME=`sed '/^Name=/!d;s/.*=//' $MYINFO_FILE`
7+
if [[ ${#ID} -le 7 ]]; then
8+
echo "Please fill your information in myinfo.txt!!!"
9+
exit 1
10+
fi
11+
ID="${ID##*\r}"
12+
}
13+
14+
copy_v_file() {
15+
if [[ ! -f $OSCPU_PATH/projects/soc/vsrc/${1} ]]; then
16+
printf "Please place \e[1;31m%s\e[0m in \e[1;31m%s\e[0m.\n" ${1} $OSCPU_PATH/projects/soc/vsrc/
17+
exit 1
18+
fi
19+
cp $OSCPU_PATH/projects/soc/vsrc/${1} $SUBMIT_FLODER/
20+
}
21+
22+
check_file() {
23+
if [[ ! -f $SUBMIT_HOME/${1} ]]; then
24+
printf "Please place \e[1;31m%s\e[0m in \e[1;31m%s\e[0m.\n" ${1} $OSCPU_PATH/$SUBMIT_FLODER
25+
exit 1
26+
fi
27+
}
28+
29+
cpu_check() {
30+
cd $SUBMIT_HOME
31+
OUTPUT=$(echo ${ID:0-4} | python3 $OSCPU_PATH/libraries/ysyxSoC/ysyx/soc/cpu-check.py)
32+
if [[ ! $OUTPUT =~ "Your core is fine in module name and signal interface" ]]; then
33+
printf "Failed to check your module name and signal interface!!! Please modify your code according to the requirements in \e[1;31mhttps://github.com/OSCPU/ysyxSoC\e[0m.\n"
34+
exit 1
35+
fi
36+
rm cpu-check.log
37+
cd $OSCPU_PATH
38+
}
39+
40+
get_default_url() {
41+
git remote -v | while read line; do
42+
if [[ $line =~ "origin" ]] && [[ $line =~ "push" ]]; then
43+
echo $1
44+
echo $line | grep -o '\ .*\ '
45+
return
46+
fi
47+
done
48+
}
49+
50+
push_repo() {
51+
URL="$(get_default_url $1)"
52+
53+
printf "Enter a new URL to replace the default push URL(\e[1;34m%s\e[0m) or leave a blank to skip.\n" $URL
54+
read -p "Enter your new push URL: " -e INPUT
55+
if [[ -n "$INPUT" ]] && [[ ! $INPUT == $URL ]]; then
56+
git remote set-url --push origin $INPUT
57+
else
58+
INPUT=$URL
59+
fi
60+
61+
git commit -m "dc & vcs" --no-verify --allow-empty 1>/dev/null 2>&1
62+
63+
git push origin
64+
if [ $? -ne 0 ]; then
65+
printf "\e[1;31mFailed to push!!!\e[0m\n"
66+
exit 1
67+
fi
68+
69+
printf "You repo has been pushed to \e[1;32m%s\e[0m.\n" $INPUT
70+
}
71+
72+
73+
OSCPU_PATH=$(dirname $(readlink -f "$0"))
74+
SUBMIT_FLODER="submit"
75+
SUBMIT_HOME=$OSCPU_PATH/$SUBMIT_FLODER
76+
WARNGING_FILE="Verilator中Warning无法清理说明.xlsx"
77+
MYINFO_FILE=$OSCPU_PATH"/myinfo.txt"
78+
79+
get_id
80+
printf "Read ID \e[1;32m%s\e[0m from myinfo.txt\n" $ID
81+
82+
PREFIX="ysyx_${ID:0-6}"
83+
V_FILE=$PREFIX".v"
84+
PDF_FILE=$PREFIX".pdf"
85+
86+
check_file $WARNGING_FILE
87+
check_file $PREFIX".pdf"
88+
copy_v_file $PREFIX".v"
89+
90+
cpu_check
91+
push_repo

0 commit comments

Comments
 (0)