IT代考 ELEC1601_ELEC9601 End of Sem (practice)

Quiz: ELEC1601_ELEC9601 End of Sem (practice)

ELEC1601_ELEC9601 End of Sem (practice)

Copyright By PowCoder代写 加微信 powcoder

Quiz Instructions

1 ptsQuestion 1

A machine code must support arithmetic instructions of the following format:

opcode, destination register, source register.

e.g. SUB, R0, R1 translates to perform the subtract R0 – R1 and store the result in

The total number of different arithmetic instructions that must be supported is 212,
with 2^5 different registers. All bits for this instruction are utilised in the encoding.

What is the minimum number of bits required for this machine code?

1 ptsQuestion 2

Suppose you have a circuit that implements the following truth table:

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 2/12

Suppose you then create two instances of this circuit and wire them up as follows
(the second instance has its final input inverted):

What is the output of the circuit if a=0, b=1, c=1?

1 ptsQuestion 3

Study the following circuit and timing diagram (consisting of D-type latches, D-type
Flip-Flops and Logic Gates):

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 3/12

What is the value for Out at the highlighted times (if it cannot be determined, write

(highlighted red) = [ Select ]

(highlighted yellow) = [ Select ]

1 ptsQuestion 4

Study the following Finite State Machine:

Complete the truth table showing how to compute the next state from the current

Where state(1) (and nextState(1)) is the MSB

State(1) State(0) I nextState(1) nextState(0)

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 4/12

1 ptsQuestion 5

Assume that a memory is initialised as follows:

0xC336 0x00

0xC337 0x00

0xC338 0x00

0xC339 0x10

0xC33A 0x00

0xC33B 0x11

Suppose the X register is initialised to 0xC338 and the following commands are

What is the value in R2? (Write your answer in decimal)

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 5/12

1 ptsQuestion 6

Assume that a memory is initialised as follows:

0x00C336 0x28

0x00C337 0x22

0x00C338 0x35

0x00C339 0x36

0x00C33A 0x85

0x00C33B 0x52

A computer system has the value 0x00C338 in its stack pointer. The stack grows
(when you push data) towards lower memory positions. Suppose the system
executes the sequence of instructions:

What value is in R3. (Write your answer in decimal. If it cannot be computed given
the above information, enter the value 0)

1 ptsQuestion 7

Suppose the following two instructions are executed:

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 6/12

ANDI R20, 5

BREQ Destination

The machine code for the BREQ instruction is as follows:

1111 0000 0000 1001

Assume the following register values:

Program counter = 0x001

R20 = 0x09

What is the new value of the PC?

The relevant information for the instruction set is given below:

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 7/12

1 ptsQuestion 8

Study the following code (you can assume “. . .” refers to code that is not shown)

LDI R27, hi8(d1) ; PC = 0x0A32, SP = 0x0B17
LDI R26, lo8(d1)
LD R18, X+
ADD R18, R18
CALL subroutine1
POP R18 ; What is the value of the PC after the completion of this line

subroutine1:

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 8/12

You can assume that the address of subroutine1 is 0x1A17 and that this code
was generated by the AVR-GCC compiler and follows the relevant conventions

What is the value of the Program Counter after the completion of the highlighted
line of code? (Write your answer in Decimal)

1 ptsQuestion 9

Consider the following definitions for d1, which represents a 4 byte array of integer

d1: .byte 0, 1, 2, 3

(1st element of the array for d1 has the value 0, 2nd element of the array for d1
has the value 1, 4th element of the array has the value 3)

If d1 is located in address 0x0626, what is the value of the second element of d1
after executing the following instructions? (Write your answer in Decimal)

LDI R27, hi8(d1)
LDI R26, lo8(d1)
LDI R19, hi8(d1)
LDI R18, lo8(d1)
ST X+, R18
ADD R19 R18
ST -X, R19

1 ptsQuestion 10

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 9/12

An AVR assembly program defines the following variables and labels:

.section .data

D1: .byte 1, 4

D2: .byte 7, 9, 7

If the address of D1 is 0x43, what is the address of D2? (Write your answer in

1 ptsQuestion 11

What is the decimal value (base 10) held in R9 after the following sequence of
instructions?

LDI R18, 0x24

MOV R9, R18

SUB R18, R9

1 ptsQuestion 12

Study the following program

It was generated by the compiler avr-gcc that uses the AVR libc library, so obeys
the convention for register management

LDI R18, 6

2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 10/12

CALL subroutine1; Call the subroutine
ADD R20 R2
ADD R20 R18

subroutine1:
; Values for the registers after this line of code are shown in the text belo

Suppose at the end of the subroutine (the line highlighted in Red) R0=6, R2=7,

What is the value stored in R20 after the line highlighted in Green is complete?
Write 0 if unknown. Write your answer in Decimal

1 ptsQuestion 13

Study the following program

It was generated by the compiler avr-gcc that uses the AVR libc library, so obeys
the convention for register management

LDI R20, 6
LDI R21, 7
LDI R22, 7
LDI R23, 7
LDI R24, [a5]
CALL subroutine1; Call the subroutine

subroutine1:
IN R31, 0x3E ; Z <- SP IN R30, 0x3D LDD R18, Z+4 LDD R19, Z+5 2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice) https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 11/12 ADD R18, R19 ; What is the value for R18 after execution of this line? Reminder, the IN R31, 0x3E ; IN R30, 0x3D commands load the stack pointer into the Z register What is the value stored in R18 in subroutine 1 (before the ...). Write 0 if unknown. Write your answer in Decimal 1 ptsQuestion 14 Study the following handwritten (potentially buggy) code (you can assume ". . ." refers to code that is not shown LDS R25, x CALL subroutine1 ; This instruction is at location 0x1279 subroutine1: ; This subroutine is at location 0xAB85 MOV R25, R8 CALL subroutine2 MOV R24, R7 ; result subroutine2: ; This subroutine is at location 0xAD12. No code is missing f rom this subroutine Assume the return address stored in the stack by the CALL instruction is 3 bytes. What is the value of the Program Counter after the RET instruction in Subroutine 2? (Write your answer in Decimal, write 0 if unknown) 2022/10/30 18:54 Quiz: ELEC1601_ELEC9601 End of Sem (practice) https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 12/12 Saved at 18:54 1 ptsQuestion 15 Suppose you have a computer system with a 5 stage pipeline and clock period of Assuming there are no pipeline stalls (no branching, no I/O requests, no interrupts etc.), how many instructions could be completed in 4 s Submit Quiz 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com