- #1
mathmari
Gold Member
MHB
- 5,049
- 7
Hey!
We have that MIMA (Neumann MInimal MAchine) has the following commands:
View attachment 6290
View attachment 6291
View attachment 6292
I want to write a MIMA program that takes the value $2^{23}-24=8.388.584$ to the memory $y$.
We have to take attention at the number of the bits, that we need for the representation of the number in two's complement.
How do exactly do we make the representation? (Wondering)
The other part is the following, or not?
Then I want to implement the Mima-command EQL adr (equal?) with the other Mima-commands.
We have that for that command it holds the following: $$\text{Accu} \leftarrow \left\{\begin{matrix}
-1 , &\text{ Accu }=M(adr)\\
0 , &\text{otherwise}
\end{matrix}\right.$$
I have done the following:
My idea is to compute -M(adr) and then to add it to Accu, and then to check if it i <0.
And then to compute the inverse of the result and check if it is <0.
Is it correct? (Wondering)
Is the implementation correct? Could I improve something? (Wondering)
We have that MIMA (Neumann MInimal MAchine) has the following commands:
Code:
LCD const : Load constant
LDV adr : Load value from address
LDIV adr : Load value indirect from address
STV adr : Set value at address
STIV adr : Set value indirect at address
View attachment 6290
Code:
NOT : Inverse of the constant-bits
RAR : Rotate accumulator right
View attachment 6291
Code:
ADD adr : Addition
AND adr : bitwise AND
OR adr : bitwise OR
XOR adr : bitwise exclusive OR
View attachment 6292
Code:
JMP adr : Jump
JMN adr : Jump if negative
We have to take attention at the number of the bits, that we need for the representation of the number in two's complement.
How do exactly do we make the representation? (Wondering)
The other part is the following, or not?
Code:
LDC const
STIV y
We have that for that command it holds the following: $$\text{Accu} \leftarrow \left\{\begin{matrix}
-1 , &\text{ Accu }=M(adr)\\
0 , &\text{otherwise}
\end{matrix}\right.$$
I have done the following:
My idea is to compute -M(adr) and then to add it to Accu, and then to check if it i <0.
And then to compute the inverse of the result and check if it is <0.
Is it correct? (Wondering)
Code:
LCD const
LDV adr
NOT
STV adr
ADD adr
STV adr
JMN x
LDC -1
JMP z
x: LCD 0
z: NOT
JMN m
LDC -1
JMP n
m: LCD 0
n: STV adr
Is the implementation correct? Could I improve something? (Wondering)
Attachments
Last edited by a moderator: