EEET2505 - Introduction To Embedded Systems Assessment 1 - Early Feedback Individual Quiz (15 Marks)
EEET2505 - Introduction To Embedded Systems Assessment 1 - Early Feedback Individual Quiz (15 Marks)
Problem Set: 1B
Total Available Mark: 15 marks
Important Notes:
1. You have 120 minutes to complete the quiz (including questions reading + assessment work + result
submission). You only have 01 attempt to solve it.
2. All problems solving with calculations must be HAND-WRITTEN, do not type. On your own paper, you
don’t need to redraw the table, you just need to write down your answer as shown in the example below:
Example: Blank (1): ABC; Blank (2): XYZ, etc.
3. Each submitted quiz solving page must have your name and your ID. Failure to include your name and
student ID number in your submitted pictures will be classified as "plagiarism".
4. All pictures must be clearly taken, and that the problem solving must be readable.
5. Submit 1 file for 1 question only. No tolerance. You can put all pages into a single PDF file.
6. This is an open book quiz. You are permitted to use your written notes and Internet sources during the
quiz.
7. Please give the details of your solutions in the spaces provided on the paper itself.
8. You are recommended to attempt all of questions provided.
9. Your solution should be detailed.
RMIT Classification: Trusted
3 Add Accumulator with a data ADD A, addr 0010 Add a data stored at the indicated address addr to the
from memory For example Accumulator, then leaving the result in the Accumulator.
ADD A, 0b10011 (A) (A) + mem[addr]
(addr here is in Note – if the Sum is overflow (over 8 bit), a Carry flag C
Binary) will be set to 1.
4 Subtract Register from SUBB A, Rn 0011 Subtract the register Rn from the Accumulator, then
Accumulator leaving the result in the Accumulator.
(A) (A) - (Rn)
5 Subtract an immediate data SUBB A,#data 0100 Subtract an immediate data from the Accumulator, then
from Accumulator For example leaving the result in the Accumulator.
SUBB A, 0x12 (A) (A) - #data
(#data is in HEX) Note – if the resultant Accumulator is Zero, a Zero flag Z
will be set to 1
6 Bitwise AND with Register ANL A, Rn 0101 Perform the bitwise logical-AND operation between the
For example Register Rn and the Accumulator, then store the results in
the Accumulator.
ANL A, R4
(A) (A) & (Rn)
RMIT Classification: Trusted
7 Copy an immediate data to MOV A,#data 0110 Copy an immediate data to the Accumulator.
Accumulator (#data is in HEX) (A) #data
8 Jump if Carry flag is set JC addr 0111 If the Carry flag is 1 (see instruction 3 above), JC will
For example branch to the indicated address; otherwise, it proceeds
with the next instruction
JC, 0b10011
IF (C) = 1
THEN (PC) addr
ELSE (PC) (PC) + 1
9 Load Register with an MOV Rn,#data 1000 Copy an immediate data to the Register Rn
immediate data (Rn) #data
For example Note –The data for this instruction is only 5-bit long and
MOV R3, 0b10011 represented in binary instead of HEX. Three Zeros “000”
will be added to the data before being copied to the
(this instruction
Register.
#data is in Binary)
RMIT Classification: Trusted
11 10 9 8 7 6 5 4 3 2 1 0
Instruction Data
Opcode
(Address, Data, Register)
Couple notes for the instructions:
• The CPU work with data that is 8 bit long (or 2 Hexadecimal digit).
• The address is 5-bit long.
• For instructions where we don’t need operands or data instructions, the remaining least significant bits of the instruction will be Zeros.
o For example, ADD A, Rn
0 0 0 1 N2 N1 N0 0 0 0 0 0
0 0 1 0 1 0 0 1 1 0 0 0
• For each instruction, after the instruction is fetched from the memory, the Program Counter (PC) will increase by 1 to point to the next
instruction, except for the instruction JC, which will make the Program Counter will point to a designated address.
RMIT Classification: Trusted
Address Tasks Mnemonic code (Assembly code) Machine code (in HEX)
Each correct answer is worth 0.2 marks Each correct answer is worth 0.2 marks
0b00000 Copy 0xCN to Accumulator (1) (2)
00001 Load Register R3 with 0b01001 (3) (4)
00010 No Operation NOP 0x000
00011 Add Register R3 to Accumulator (5) (6)
00100 No Operation NOP 0x000
00101 Load Register R2 with 0b01101 (7) (8)
00110 Bitwise AND with Register R2 (9) (10)
00111 Copy 0xFC to Accumulator (11) (12)
01000 Add Register R2 to Accumulator (13) (14)
Check if the Carry is 1 then jump to (15)
01001 address 0b01110 (16)
01010 Copy 0x9N to Accumulator (17) (18)
01110 Subtract 0x05 from Accumulator (19) (20)
Accumulator at the end of the program in Binary, write the bits in the following box (0.5 marks)
(21)
RMIT Classification: Trusted
• Assign mnemonic codes for these new instructions. Hint – you can adopt the way the mnemonic codes of the previous
instructions.
• Define their specific instruction format (which still needs to meet the generic instruction format of the MCU).
The instruction 10 has been filled as an example
Address Tasks Mnemonic code (Assembly code) Machine code (in HEX) Values after
Instructions
Value of R7 at the end of the program, write the bits in the following box (0.5 marks)
(44)