Computer Organization: Binary number representation, Boolean logic, circuits and gates, machine language.
10001000000000010001, where 10001 is an opcode indicating the STORE X command, meaning to copy the contents of the register R to memory address X.
1000000010000110
| input 1 | input 2 | output 1 |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| input 1 | input 2 | input 3 | output 1 | output 2 |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 |
NOT(Found=No AND I<10,000) OR (I<=0)
Let the logic variables P , Q and R represent the sub-expressions Found=No , I<10,000, and I<=0 respectively.
NOT (a OR (NOT b))
(NOT a) AND b
Are they equivalent? (Two expression are equivalent if their truth tables are identical).
| Address | Contents of memory cell |
|---|---|
| 0 | LOAD 17 |
| 1 | ADD 18 |
| 2 | STORE 17 |
| 3 | INCREMENT 18 |
| 4 | INCREMENT 18 |
| 5 | LOAD 16 |
| 6 | COMPARE 18 |
| 7 | JUMPLT 0 |
| 8 | OUT 17 |
| 9 | HALT |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | 12 |
| 17 | 0 |
| 18 | 1 |
a = r.readInt();
r.readLine();
b = r.readInt();
r.readLine();
c = 0;
while (b>0) {
c = c+a;
b = b-1;
}
System.out.print(c);
| Address | Contents of memory cell |
|---|---|
| 0 | |
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 |