-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
61 lines (46 loc) · 1001 Bytes
/
main.go
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
package main
import (
"fmt"
"github.com/bruunoromero/cpu-emulator/vm"
)
func getWordLengh() int {
var vl int
fmt.Println("Qual o tamano da palavra em bits (16, 32, 64): ")
for {
fmt.Scanf("%d", &vl)
if vl == 16 || vl == 32 || vl == 64 {
return int(vl)
}
}
}
func getBusLength() int {
var vl int
fmt.Println("Qual o tamano da largura do barramento em bytes (8, 16, 32): ")
for {
fmt.Scanf("%d", &vl)
if vl == 8 || vl == 16 || vl == 32 {
return int(vl)
}
}
}
func getFrequency() int {
var vl int
fmt.Println("Qual a frequencia em Mhz: ")
for {
fmt.Scanf("%d", &vl)
return int(vl)
}
}
func main() {
frequency := getFrequency()
bus := getBusLength()
word := getWordLengh()
fmt.Println("")
fmt.Println("-----------------------")
fmt.Println(" Starting VM ")
fmt.Println("-----------------------")
fmt.Println("")
fmt.Println("Log: VM Started")
fmt.Println("")
vm.Start([]string{"A", "B", "C", "D", "E"}, bus, word, 1024, frequency)
}