-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpu_test3.java
32 lines (27 loc) · 1.33 KB
/
cpu_test3.java
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
package ComputerArchitecture;
/*
Jan Karl Galia
Comp. Architecture ******************NOTE TO USERS: TESTS ARE AUTOMATED, VALUES(BINARY BIT ARRAYS AND INTEGERS) ARE RANDOMLY GENERATED************
*************TO CONVERT TO T,F RATHER THAN 1,0, REPLACE toStringConvert() to toString()**********
HW 10: Stack
*/
public class cpu_test3{
public static void main(String[] args) {
runTests();
}
public static void runTests() {
testRun();
}
public static void testRun() {
//---PROGRAM TESTING JUMP-----------------------------------------------------
computer testComp = new computer();
System.out.println("-----------------TESTING PROGRAM JUMP----------------------");
//Testing PROGRAM
String[] code = new String[]{"move R1 3" , "move R2 4", "push R1","push R2","call 500","pop R15","pop R1","pop R2","add R1 R2 R3","push R3","push R15","return","return","interrupt 0"};
String[] assembledCode = Assembler.assemble(code);
testComp.preload(assembledCode);
testComp.run();
System.out.println("-----------------TESTING PROGRAM JUMP----------------------");
// ---------------------------------PROGRAM TESTING JUMP-----------------------------------------------------
}
}