Skip to content

Commit 6b77840

Browse files
btns support
1 parent 43cdd81 commit 6b77840

3 files changed

Lines changed: 13 additions & 176 deletions

File tree

programs/hello.hex

Lines changed: 2 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,176 +1,2 @@
1-
00004137
2-
00c000ef
3-
0000006f
4-
00000013
5-
fc010113
6-
02112e23
7-
02812c23
8-
04010413
9-
fc042223
10-
0a000793
11-
fef42623
12-
07800793
13-
fef42423
14-
00100793
15-
fef42223
16-
00100793
17-
fef42023
18-
fc042e23
19-
0b40006f
20-
fdc42783
21-
00e79793
22-
00078713
23-
fc442783
24-
00e787b3
25-
fff00713
26-
00e78023
27-
fdc42703
28-
000137b7
29-
ac078793
30-
00f707b3
31-
00e79793
32-
00078713
33-
fc442783
34-
00e787b3
35-
fff00713
36-
00e78023
37-
fdc42703
38-
00070793
39-
00279793
40-
00e787b3
41-
00679793
42-
00178793
43-
00e79793
44-
00078713
45-
fc442783
46-
00e787b3
47-
fff00713
48-
00e78023
49-
fdc42703
50-
00070793
51-
00279793
52-
00e787b3
53-
00679793
54-
13f78793
55-
00e79793
56-
00078713
57-
fc442783
58-
00e787b3
59-
fff00713
60-
00e78023
61-
fdc42783
62-
00178793
63-
fcf42e23
64-
fdc42703
65-
13f00793
66-
f4e7d4e3
67-
ffe00793
68-
fcf42c23
69-
0780006f
70-
ffe00793
71-
fcf42a23
72-
0540006f
73-
fe842703
74-
fd442783
75-
00f70733
76-
00070793
77-
00279793
78-
00e787b3
79-
00679793
80-
00078713
81-
fec42783
82-
00f70733
83-
fd842783
84-
00f707b3
85-
00e79793
86-
00078713
87-
fc442783
88-
00e787b3
89-
00078023
90-
fd442783
91-
00178793
92-
fcf42a23
93-
fd442703
94-
00200793
95-
fae7d4e3
96-
fd842783
97-
00178793
98-
fcf42c23
99-
fd842703
100-
00200793
101-
f8e7d2e3
102-
fec42703
103-
fe442783
104-
00f707b3
105-
fef42623
106-
fe842703
107-
fe042783
108-
00f707b3
109-
fef42423
110-
fec42703
111-
13900793
112-
00f71663
113-
fff00793
114-
fef42223
115-
fec42703
116-
00600793
117-
00f71663
118-
00100793
119-
fef42223
120-
fe842703
121-
0e900793
122-
00f71663
123-
fff00793
124-
fef42023
125-
fe842703
126-
00600793
127-
00f71663
128-
00100793
129-
fef42023
130-
ffe00793
131-
fcf42823
132-
07c0006f
133-
ffe00793
134-
fcf42623
135-
0580006f
136-
fe842703
137-
fcc42783
138-
00f70733
139-
00070793
140-
00279793
141-
00e787b3
142-
00679793
143-
00078713
144-
fec42783
145-
00f70733
146-
fd042783
147-
00f707b3
148-
00e79793
149-
00078713
150-
fc442783
151-
00e787b3
152-
fff00713
153-
00e78023
154-
fcc42783
155-
00178793
156-
fcf42623
157-
fcc42703
158-
00200793
159-
fae7d2e3
160-
fd042783
161-
00178793
162-
fcf42823
163-
fd042703
164-
00200793
165-
f8e7d0e3
166-
fc042423
167-
0140006f
168-
00000013
169-
fc842783
170-
00178793
171-
fcf42423
172-
fc842703
173-
000017b7
174-
f9f78793
175-
fee7d2e3
176-
e4dff06f
1+
4b0000b7
2+
00008103

src/main/scala/RISCV/Main.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class Main() extends Module {
1919
val rgb = Output(UInt(12.W))
2020
val blanking = Output(Bool())
2121

22+
val btns = Input(UInt(4.W))
23+
2224
val debug_1 = Output(UInt(32.W))
2325
val debug_2 = Output(UInt(32.W))
2426
})
@@ -43,6 +45,7 @@ class Main() extends Module {
4345
alu.io.b := 0.U(32.W)
4446

4547
val memory = Module(new Memory())
48+
memory.io.btns := io.btns
4649

4750
val vga_controller = Module(new VGAController())
4851
vga_controller.io.address := memory.io.address_vga

src/main/scala/RISCV/Memory.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class Memory() extends Module {
2121
val address_vga = Output(UInt(32.W))
2222
val write_vga = Output(Bool())
2323
val write_value_vga = Output(UInt(32.W))
24+
25+
val btns = Input(UInt(4.W))
2426
})
2527

2628
val memory = SyncReadMem(1024, UInt(32.W))
@@ -67,4 +69,10 @@ class Memory() extends Module {
6769
io.write_2
6870
)
6971

72+
val is_btns = RegInit(false.B)
73+
is_bts := io.address_1 === 0x12c00000.U // 0x4B000000
74+
75+
when(is_btns && io.read_1) {
76+
io.read_value_1 := io.btns
77+
}
7078
}

0 commit comments

Comments
 (0)