This repository has been archived by the owner on Sep 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Control.js
73 lines (70 loc) · 1.62 KB
/
Control.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Bisher folgende Steuerleitungen:
* - RegDst
* - Jump
* - Branch
* - ALUOp
* - MemToReg
* - MemWrite
* - ALUSrc
* - RegWrite
*/
function Control() {
}
Control.prototype.receive = function(bitVector) {
// R-type
if(bitVector == [0,0,0,0,0,0]) {
this.regDstWire.receive(1)
this.regWriteWire.receive(1)
this.aluSrcWire.receive(0)
this.branchWire.receive(0)
this.memWriteWire.receive(0)
this.memToRegWire.receive(0)
this.jumpWire.receive(0)
this.aluOpWire.receive([1,0])
}
// lw
if(bitVector == [1, 0, 0, 0, 1, 1]) {
this.regDstWire.receive(0)
this.regWriteWire.receive(1)
this.aluSrcWire.receive(1)
this.branchWire.receive(0)
this.memWriteWire.receive(0)
this.memToRegWire.receive(1)
this.jumpWire.receive(0)
this.aluOpWire.receive([0,0])
}
// sw
if(bitVector == [1, 0, 1, 0, 1, 1]) {
this.regDstWire.receive()
this.regWriteWire.receive(0)
this.aluSrcWire.receive(1)
this.branchWire.receive(0)
this.memWriteWire.receive(1)
this.memToRegWire.receive()
this.jumpWire.receive(0)
this.aluOpWire.receive([0,0])
}
// beq
if(bitVector == [0, 0, 0, 1, 0, 0]) {
this.regDstWire.receive()
this.regWriteWire.receive(0)
this.aluSrcWire.receive(0)
this.branchWire.receive(1)
this.memWriteWire.receive(0)
this.memToRegWire.receive()
this.jumpWire.receive(0)
this.aluOpWire.receive([0,1])
}
// j
if(bitVector == [0, 0, 0, 0, 1, 0]) {
this.regDstWire.receive()
this.regWriteWire.receive(0)
this.aluSrcWire.receive()
this.branchWire.receive()
this.memWriteWire.receive(0)
this.memToRegWire.receive()
this.jumpWire.receive(1)
this.aluOpWire.receive()
}
}