-
Notifications
You must be signed in to change notification settings - Fork 65
/
CogMIPSELCompilerTests.class.st
45 lines (40 loc) · 1.29 KB
/
CogMIPSELCompilerTests.class.st
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
Class {
#name : #CogMIPSELCompilerTests,
#superclass : #AbstractInstructionTests,
#category : #'VMMaker-OriginalTests'
}
{ #category : #accessing }
CogMIPSELCompilerTests >> assertCheckLongArithOpCodeSize: bytes [
self assert: bytes = 12.
]
{ #category : #'as yet unclassified' }
CogMIPSELCompilerTests >> assertCheckQuickArithOpCodeSize: bytes [
self assert: bytes <= 12
]
{ #category : #accessing }
CogMIPSELCompilerTests >> concreteCompilerClass [
^CogMIPSELCompilerForTests
]
{ #category : #'as yet unclassified' }
CogMIPSELCompilerTests >> memoryAsBytes: instructionMachineCode [
"Manage the fact that in the simulator inst machineCode object is an Array and the disassembler requires a ByteArray or some such."
| bytes |
instructionMachineCode isCObjectAccessor ifTrue:
[^self memoryAsBytes: instructionMachineCode object].
instructionMachineCode isArray ifFalse:
[self assert: instructionMachineCode class isBits.
^instructionMachineCode].
bytes := ByteArray new: instructionMachineCode size * 4.
1 to: instructionMachineCode size do:
[:i|
(instructionMachineCode at: i) ifNotNil:
[:word|
bytes unsignedLongAt: i - 1* 4 + 1 put: word]].
^bytes
]
{ #category : #accessing }
CogMIPSELCompilerTests >> processor [
processor ifNil:
[processor := MIPSELSimulator new].
^processor
]