Skip to content

Commit 4956621

Browse files
committed
cleanup
1 parent a005ba3 commit 4956621

File tree

7 files changed

+256
-83
lines changed

7 files changed

+256
-83
lines changed

apps/frisc/harness/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ cargo run --bin filament ../src/cpu.fil --library ../../.. --backend calyx --dis
77

88
python expected.py
99

10-
# rm top.err top.out top.json frisc.futil
10+
rm top.err top.out top.json frisc.futil

apps/frisc/harness/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
test1 = """
77
addi x1 x0 2
8+
addi x0 x0 0
9+
addi x0 x0 0
10+
addi x0 x0 0
811
sw x1 0(x1)
912
"""
1013

apps/frisc/harness/top.futil

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ component main (@clk clk: 1, @reset reset: 1, @go go: 1) -> () {
88
cpu = CPU();
99

1010
pc_reg = std_reg(32);
11+
rf_reg = std_reg(32);
1112
}
1213
wires {
1314
static<1> group read_iram {
15+
cpu.go = 1'd1;
1416
iram.addr0 = cpu.pc;
1517

1618
cpu.instr = iram.read_data;
@@ -31,17 +33,23 @@ component main (@clk clk: 1, @reset reset: 1, @go go: 1) -> () {
3133
pc_reg.in = cpu.pc;
3234
pc_reg.write_en = %0 ? 1'd1;
3335
}
36+
37+
static<1> group reg_rf {
38+
rf_reg.in = cpu.rfDataOut;
39+
rf_reg.write_en = %0 ? 1'd1;
40+
}
3441

3542
cpu.pcin = cpu.nextpc;
36-
cpu.rfDataIn = cpu.rfDataOut;
43+
cpu.rfDataIn = rf_reg.out;
3744
}
3845
control {
3946
static seq {
40-
static repeat 6 {
47+
static repeat 10 {
4148
static par {
4249
read_iram;
4350
write_res;
4451
reg_pc;
52+
reg_rf;
4553
}
4654
}
4755
}

apps/frisc/harness/top_2_64.futil

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import "frisc.futil";
2+
import "primitives/memories/comb.futil";
3+
4+
component main (@clk clk: 1, @reset reset: 1, @go go: 1) -> () {
5+
cells {
6+
@external iram = comb_mem_d1(32,2,32);
7+
@external res = comb_mem_d1(32,64,32);
8+
cpu = CPU();
9+
10+
pc_reg = std_reg(32);
11+
rf_reg = std_reg(32);
12+
}
13+
wires {
14+
static<1> group read_iram {
15+
cpu.go = 1'd1;
16+
iram.addr0 = cpu.pc;
17+
18+
cpu.instr = iram.read_data;
19+
// cpu.dataIn = dram.read_data;
20+
21+
// dram.addr0 = cpu.memAddr;
22+
// dram.write_data = cpu.memData;
23+
// dram.write_mask = cpu.memWriteMask;
24+
}
25+
26+
static<1> group write_res {
27+
res.addr0 = cpu.memAddr;
28+
res.write_data = cpu.memData;
29+
res.write_en = cpu.isStore;
30+
}
31+
32+
static<1> group reg_pc {
33+
pc_reg.in = cpu.pc;
34+
pc_reg.write_en = %0 ? 1'd1;
35+
}
36+
37+
static<1> group reg_rf {
38+
rf_reg.in = cpu.rfDataOut;
39+
rf_reg.write_en = %0 ? 1'd1;
40+
}
41+
42+
cpu.pcin = cpu.nextpc;
43+
cpu.rfDataIn = rf_reg.out;
44+
}
45+
control {
46+
static seq {
47+
static repeat 6 {
48+
static par {
49+
read_iram;
50+
write_res;
51+
reg_pc;
52+
reg_rf;
53+
}
54+
}
55+
}
56+
}
57+
}

apps/frisc/harness/top_5_64.futil

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import "frisc.futil";
2+
import "primitives/memories/comb.futil";
3+
4+
component main (@clk clk: 1, @reset reset: 1, @go go: 1) -> () {
5+
cells {
6+
@external iram = comb_mem_d1(32,5,32);
7+
@external res = comb_mem_d1(32,64,32);
8+
cpu = CPU();
9+
10+
pc_reg = std_reg(32);
11+
rf_reg = std_reg(32);
12+
}
13+
wires {
14+
static<1> group read_iram {
15+
cpu.go = 1'd1;
16+
iram.addr0 = cpu.pc;
17+
18+
cpu.instr = iram.read_data;
19+
// cpu.dataIn = dram.read_data;
20+
21+
// dram.addr0 = cpu.memAddr;
22+
// dram.write_data = cpu.memData;
23+
// dram.write_mask = cpu.memWriteMask;
24+
}
25+
26+
static<1> group write_res {
27+
res.addr0 = cpu.memAddr;
28+
res.write_data = cpu.memData;
29+
res.write_en = cpu.isStore;
30+
}
31+
32+
static<1> group reg_pc {
33+
pc_reg.in = cpu.pc;
34+
pc_reg.write_en = %0 ? 1'd1;
35+
}
36+
37+
static<1> group reg_rf {
38+
rf_reg.in = cpu.rfDataOut;
39+
rf_reg.write_en = %0 ? 1'd1;
40+
}
41+
42+
cpu.pcin = cpu.nextpc;
43+
cpu.rfDataIn = rf_reg.out;
44+
}
45+
control {
46+
static seq {
47+
static repeat 10 {
48+
static par {
49+
read_iram;
50+
write_res;
51+
reg_pc;
52+
reg_rf;
53+
}
54+
}
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)