Skip to content

Commit bf9e562

Browse files
Work on thread
1 parent 98de42a commit bf9e562

3 files changed

Lines changed: 49 additions & 4 deletions

File tree

src/main/scala/main/Core.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import chisel3._
22
import chisel3.util._
33
import _root_.circt.stage.ChiselStage
44

5-
object Operation extends ChiselEnum {
6-
val Add, Sub, Mul, Div, JumpE, JumpNE = Value
7-
}
8-
95
class Core extends Module {
106
val io = IO(new Bundle {
117
val operation = Input(Operation());
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import chisel3._
2+
import chisel3.util._
3+
import _root_.circt.stage.ChiselStage
4+
5+
object Operation extends ChiselEnum {
6+
val NoOp, Add, Sub, Mul, Div, JumpE, JumpNE, Compare, End, Load, Write = Value
7+
}

src/main/scala/main/Thread.scala

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import chisel3._
2+
import chisel3.util._
3+
import _root_.circt.stage.ChiselStage
4+
5+
class Thread extends Module {
6+
val io = IO(new Bundle {
7+
val store_operation = Input(Bool());
8+
val operation = Input(Operation());
9+
val immediate_a = Input(UInt(8.W));
10+
val immediate_b = Input(UInt(8.W));
11+
12+
val end_of_program = Output(Bool());
13+
val idle = Output(Bool());
14+
})
15+
16+
val operation = RegInit(Operation.NoOp);
17+
val immediate_a = RegInit(0.U(8.W));
18+
val immediate_b = RegInit(0.U(8.W));
19+
20+
val end_of_program = RegInit(false.B);
21+
val idle = RegInit(true.B);
22+
23+
val alu = Module(Alu())
24+
val lsu = Module(Lsu())
25+
val program_counter = Module(ProgramCounter())
26+
27+
val immediate_b = RegInit(0.U(8.W));
28+
29+
io.end_of_program := end_of_program;
30+
io.idle := idle;
31+
32+
when(io.store_operation) {
33+
operation := io.operation;
34+
immediate_a := io.immediate_a;
35+
immediate_b := io.immediate_b;
36+
37+
when(operation === Operation.Add || operation === Operation.Sub || operation === Operation.Mul || operation === Operation.Div) {
38+
alu.
39+
}
40+
41+
}
42+
}

0 commit comments

Comments
 (0)