Skip to content

Commit 7558368

Browse files
authored
Merge pull request OSCPU#33 from OSCPU/develop
Reorganize files, update OoO execution backend
2 parents c90cbda + 27520d3 commit 7558368

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+891
-837
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ xcuserdata
314314
.cache
315315
.history
316316
.lib/
317+
.coursier/
317318
dist/*
318319
target/
319320
lib_managed/

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,23 @@ $(REF_SO):
9292
endif
9393

9494
$(EMU): $(EMU_MK) $(EMU_DEPS) $(EMU_HEADERS) $(REF_SO)
95-
CPPFLAGS=-DREF_SO=\\\"$(REF_SO)\\\" $(MAKE) -C $(dir $(EMU_MK)) -f $(abspath $(EMU_MK))
95+
CPPFLAGS=-DREF_SO=\\\"$(REF_SO)\\\" $(MAKE) VM_PARALLEL_BUILDS=1 -C $(dir $(EMU_MK)) -f $(abspath $(EMU_MK))
9696

9797
SEED = -s $(shell seq 1 10000 | shuf | head -n 1)
9898

99+
# log will only be printed when (LOG_BEGIN<=GTimer<=LOG_END) && (LOG_LEVEL < loglevel)
100+
# use 'emu -h' to see more details
101+
LOG_BEGIN ?= 0
102+
LOG_END ?= 0
103+
LOG_LEVEL ?= ALL
104+
99105
emu: $(EMU)
100-
@$(EMU) -i $(IMAGE) $(SEED)
106+
@$(EMU) -i $(IMAGE) $(SEED) -b $(LOG_BEGIN) -e $(LOG_END) -v $(LOG_LEVEL)
101107

102108
cache:
103109
$(MAKE) emu IMAGE=Makefile
104110

105111
clean:
106112
rm -rf $(BUILD_DIR)
107113

108-
.PHONY: verilog emu clean help $(REF_SO)
114+
.PHONY: verilog emu clean help $(REF_SO)

debug/Makefile

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
ARCH = ARCH=riscv64-nutshell
2-
NANOS_HOME ?= $(AM_HOME)/../nanos-lite
3-
SINGLETEST = ALL=recursion
4-
RVTEST_TARGET = towers
1+
# ------------------------------------------------------------------
2+
# test settings
3+
# ------------------------------------------------------------------
4+
5+
LOG_BEGIN ?= 0
6+
LOG_END ?= 0
57

8+
ARCH = ARCH=riscv64-noop
9+
# ------------------------------------------------------------------
10+
11+
SINGLETEST = recursion
12+
RVTEST_TARGET = towers
13+
NANOS_HOME ?= $(AM_HOME)/../nanos-lite
14+
EMU_ARGS = LOG_BEGIN=$(LOG_BEGIN) LOG_END=$(LOG_END)
615
CPU_TEST_RESULT = $(shell cat cpu.log | grep -E "different|stuck")
716
MB_RESULT = $(shell cat microbench.log | grep IPC)
817
MBT_RESULT = $(shell cat microbench-train.log | grep IPC)
@@ -13,14 +22,14 @@ CM_RESULT = $(shell cat coremark.log | grep IPC)
1322
# ------------------------------------------------------------------
1423

1524
cpu:
16-
$(MAKE) -C $(AM_HOME)/tests/cputest $(ARCH) ALL=dummy run
25+
$(MAKE) -C $(AM_HOME)/tests/cputest $(ARCH) $(EMU_ARGS) ALL=dummy run
1726

1827
# ------------------------------------------------------------------
1928
# unit tests
2029
# ------------------------------------------------------------------
2130

2231
cputest:
23-
$(MAKE) -C $(AM_HOME)/tests/cputest $(ARCH) run 2>&1 | tee > cpu.log
32+
$(MAKE) -C $(AM_HOME)/tests/cputest $(ARCH) $(EMU_ARGS) run 2>&1 | tee > cpu.log
2433
# cat cpu.log | grep different
2534
ifeq ($(CPU_TEST_RESULT),)
2635
@echo "simple CPU test passed"
@@ -29,17 +38,27 @@ else
2938
@echo "simple CPU test failed"
3039
endif
3140

41+
rvtest-ui:
42+
$(MAKE) -C $(RVTEST_HOME)/isa noop_run LOG_LEVEL=OFF SUITES=rv64ui ENV=p
43+
44+
rvtest:
45+
$(MAKE) -C $(RVTEST_HOME)/isa noop_run LOG_LEVEL=OFF SUITES=rv64ui ENV=p
46+
$(MAKE) -C $(RVTEST_HOME)/isa noop_run LOG_LEVEL=OFF SUITES=rv64um ENV=p
47+
$(MAKE) -C $(RVTEST_HOME)/isa noop_run LOG_LEVEL=OFF SUITES=rv64uc ENV=p
48+
$(MAKE) -C $(RVTEST_HOME)/isa noop_run LOG_LEVEL=OFF SUITES=rv64si ENV=p
49+
$(MAKE) -C $(RVTEST_HOME)/isa noop_run LOG_LEVEL=OFF SUITES=rv64mi ENV=p
50+
3251
bputest:
33-
$(MAKE) -C $(AM_HOME)/tests/bputest $(ARCH) ALL=forcall2 run 2>&1 | tee > bpu.log
52+
$(MAKE) -C $(AM_HOME)/tests/bputest $(ARCH) $(EMU_ARGS) ALL=forcall2 run 2>&1 | tee > bpu.log
3453
cat bpu.log | grep Mbp
3554

3655
unittest:
37-
$(MAKE) -C $(AM_HOME)/tests/cputest $(ARCH) $(SINGLETEST) run 2>&1 | tee > test.log
56+
$(MAKE) -C $(AM_HOME)/tests/cputest $(ARCH) $(EMU_ARGS) ALL=$(SINGLETEST) run 2>&1 | tee > test.log
3857
cat test.log | grep -E "different|stuck|GOOD"
3958
cat test.log | grep ISU > isu.log
4059

4160
microbench:
42-
$(MAKE) -C $(AM_HOME)/apps/microbench $(ARCH) mainargs=test run 2>&1 | tee > microbench.log
61+
$(MAKE) -C $(AM_HOME)/apps/microbench $(ARCH) $(EMU_ARGS) mainargs=test run 2>&1 | tee > microbench.log
4362
cat microbench.log | grep IPC
4463
@date >> history.log
4564
@git log --pretty=format:"%h %an %ad %s" -1 >> history.log
@@ -48,11 +67,11 @@ microbench:
4867
@echo -e "" >> history.log
4968

5069
microbench-train:
51-
$(MAKE) -C $(AM_HOME)/apps/microbench $(ARCH) mainargs=train run 2>&1 | tee > microbench-train.log
70+
$(MAKE) -C $(AM_HOME)/apps/microbench $(ARCH) $(EMU_ARGS) mainargs=train run 2>&1 | tee > microbench-train.log
5271
cat microbench-train.log | grep IPC
5372

5473
coremark:
55-
$(MAKE) -C $(AM_HOME)/apps/coremark $(ARCH) mainargs=test run 2>&1 | tee > coremark.log
74+
$(MAKE) -C $(AM_HOME)/apps/coremark $(ARCH) $(EMU_ARGS) mainargs=test run 2>&1 | tee > coremark.log
5675
cat coremark.log | grep IPC
5776
@date >> cm_history.log
5877
@git log --pretty=format:"%h %an %ad %s" -1 >> cm_history.log
@@ -62,15 +81,11 @@ coremark:
6281

6382

6483
dhrystone:
65-
$(MAKE) -C $(AM_HOME)/apps/dhrystone $(ARCH) mainargs=test run 2>&1 | tee > dhrystone.log
84+
$(MAKE) -C $(AM_HOME)/apps/dhrystone $(ARCH) $(EMU_ARGS) mainargs=test run 2>&1 | tee > dhrystone.log
6685
cat dhrystone.log | grep IPC
6786

68-
rvtest:
69-
$(MAKE) -C $(AM_HOME)/tests/riscv-test/benchmarks/$(RVTEST_TARGET) $(ARCH) run
70-
# usage: make rvtest RVTEST_TARGET=dhrystone
71-
7287
xj:
73-
$(MAKE) -C $(NANOS_HOME) $(ARCH) run
88+
$(MAKE) -C $(NANOS_HOME) $(ARCH) $(EMU_ARGS) run
7489

7590
xjnemu:
7691
$(MAKE) -C $(NANOS_HOME) ARCH=riscv64-nemu run
@@ -100,19 +115,22 @@ linux-debug:
100115
# test set
101116
# ------------------------------------------------------------------
102117

103-
smoke-test: cpu cputest microbench
118+
smoke-test: cpu cputest microbench coremark
104119
@echo "Smoke Test Passed"
105120

106-
regression-test: smoke-test linux
121+
regression-test: smoke-test coremark linux
107122
@echo "Regression Test Passed"
108123

109-
perf-test: smoke-test microbench-train coremark
124+
perf-test: smoke-test microbench-train
110125
@echo "Perf Test Finished"
111126

112127
# ------------------------------------------------------------------
113128
# get disassembled test src
114129
# ------------------------------------------------------------------
115130

131+
disassemble-unittest:
132+
cp $(AM_HOME)/tests/cputest/build/$(SINGLETEST)-riscv64-noop.txt ./d-unittest.log
133+
116134
disassemble-rttos:
117135
cp $(RTTOS_HOME)/bsp/riscv64-nutshell/build/code.txt ./d-rttos.log
118136

@@ -122,3 +140,9 @@ disassemble-freertos:
122140
disassemble-xv6:
123141
cp $(XV6_HOME)/build/code.txt ./d-xv6.log
124142

143+
# ------------------------------------------------------------------
144+
# chore
145+
# ------------------------------------------------------------------
146+
147+
clean:
148+
$(MAKE) -C .. clean

devlog.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

scripts/statistics.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
mymap = {}
2+
last = ""
3+
4+
with open("../build/NutShellSimTop.v", "r") as f:
5+
line = f.readline()
6+
cnt = 0
7+
while(line):
8+
if "module " in line:
9+
if last!="" :
10+
mymap[last] = cnt
11+
last = line[6:-2]
12+
cnt = 1
13+
else:
14+
cnt = cnt + 1
15+
line = f.readline()
16+
for k,v in mymap.items():
17+
print(k, v)

src/main/scala/bus/simplebus/Crossbar.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ class SimpleBusCrossbar1toN(addressSpace: List[(Long, Long)]) extends Module {
4040
val outSelResp = io.out(outSelIdxResp)
4141
val reqInvalidAddr = io.in.req.valid && !outSelVec.asUInt.orR
4242

43-
when(!(!io.in.req.valid || outSelVec.asUInt.orR) || !(!(io.in.req.valid && outSelVec.asUInt.andR))){printf("[ERROR] bad addr %x, time %d\n", addr, GTimer())}
43+
when(!(!io.in.req.valid || outSelVec.asUInt.orR) || !(!(io.in.req.valid && outSelVec.asUInt.andR))){
44+
Debug(){
45+
printf("crossbar access bad addr %x, time %d\n", addr, GTimer())
46+
}
47+
}
4448
// assert(!io.in.req.valid || outSelVec.asUInt.orR, "address decode error, bad addr = 0x%x\n", addr)
4549
assert(!(io.in.req.valid && outSelVec.asUInt.andR), "address decode error, bad addr = 0x%x\n", addr)
4650

src/main/scala/nutcore/Bundle.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ class RedirectIO extends NutCoreBundle {
4747
val valid = Output(Bool())
4848
}
4949

50+
class MisPredictionRecIO extends NutCoreBundle {
51+
val redirect = new RedirectIO
52+
val valid = Output(Bool())
53+
val checkpoint = Output(UInt(brTagWidth.W))
54+
val prfidx = Output(UInt(prfAddrWidth.W))
55+
}
56+
5057
class CtrlFlowIO extends NutCoreBundle {
5158
val instr = Output(UInt(64.W))
5259
val pc = Output(UInt(VAddrBits.W))
@@ -63,7 +70,6 @@ class DecodeIO extends NutCoreBundle {
6370
val cf = new CtrlFlowIO
6471
val ctrl = new CtrlSignalIO
6572
val data = new DataSrcIO
66-
val pipeline2 = Output(Bool())
6773
}
6874

6975
class WriteBackIO extends NutCoreBundle {
@@ -86,6 +92,8 @@ class OOCommitIO extends NutCoreBundle with HasBackendConst{
8692
val commits = Output(UInt(XLEN.W))
8793
val prfidx = Output(UInt(prfAddrWidth.W)) //also as robidx
8894
val exception = Output(Bool())
95+
val store = Output(Bool())
96+
val brMask = Output(UInt(checkpointSize.W))
8997
}
9098

9199
class FunctionUnitIO extends NutCoreBundle {
@@ -152,11 +160,13 @@ class InstFetchIO extends NutCoreBundle {
152160
val instr = Output(UInt(64.W))
153161
}
154162

163+
// Micro OP
155164
class RenamedDecodeIO extends NutCoreBundle with HasBackendConst {
156165
val decode = new DecodeIO
157166
val prfDest = Output(UInt(prfAddrWidth.W))
158167
val prfSrc1 = Output(UInt(prfAddrWidth.W))
159168
val prfSrc2 = Output(UInt(prfAddrWidth.W))
160169
val src1Rdy = Output(Bool())
161170
val src2Rdy = Output(Bool())
171+
val brMask = Output(UInt(checkpointSize.W))
162172
}

0 commit comments

Comments
 (0)