留学生作业代写 ELEC1601_ELEC9601 End of Sem (practice)

ELEC1601_ELEC9601 End of Sem (practice)

Quiz Instructions

Copyright By PowCoder代写 加微信 powcoder

1 ptsQuestion 1

ID:q1vEA custom digital logic circuit uses two sensors:

A temperature sensor with integer inputs known to lie in the range [ 24; 61 ]
A humidity sensor with inputs normalised between [0 ; 1] and a precision of

Suppose you wish to represent all possible combinations of these two sensors
with a single binary encoding.

What is the minimum number of bits required?

1 ptsQuestion 2

ID:q2vCSuppose you have a circuit that implements the following truth table:

2022/11/7 12:51 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 first input inverted):

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

1 ptsQuestion 3

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

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

(highlighted red) = [ Select ]

2022/11/7 12:51 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

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

(highlighted yellow) = [ Select ]

1 ptsQuestion 4

ID:q4vAStudy the following Finite State Machine:

Complete the truth table showing how to compute the next state from the current
state, you should assume the following binary encoding:

State A: 00

State B: 01

State C: 10

State D: 11

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

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

2022/11/7 12:51 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

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

1 ptsQuestion 5

ID:q5vCAssume that a memory is initialised as follows:

0xC336 0x01

0xC337 0x00

0xC338 0x00

0xC339 0x11

0xC33A 0x01

0xC33B 0x11

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

ADD R1, R2

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

2022/11/7 12:51 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

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

1 ptsQuestion 6

ID:q6vGAssume that a memory is initialised as follows:

0x00C336 0x64

0x00C337 0x28

0x00C338 0x31

0x00C339 0x13

0x00C33A 0x19

0x00C33B 0x65

A computer system has the value 0x00C338 in its stack pointer. The stack grows
(when you push data) towards lower memory positions (numerically lower
address). 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)

2022/11/7 12:51 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

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

1 ptsQuestion 7

ID:q7ASuppose the following two instructions are executed:

ANDI R20, 5

BREQ Destination

The machine code for the BREQ instruction is as follows:

1111 0000 0010 1001

Assume the following register values:

Program counter = 0x001 (This corresponds to the location of the ANDI
instruction, before execution)

R20 = 0x09

What is the new value of the PC? (write your answer in Decimal)

The relevant information for the instruction set is given below:

2022/11/7 12:51 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

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

1 ptsQuestion 8

ID:q8EStudy the following code (you can assume “. . .” refers to code that is not

LDI R27, hi8(d1) ; PC = 0x0A31, SP = 0x0B13
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/11/7 12:51 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 0x1A16 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

ID:q9DConsider the following definitions for d1, which represents a 4 byte array of
integer values:

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 0x0324, 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/11/7 12:51 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

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

ID:q10EAn AVR assembly program defines the following variables and labels:

.section .data

D1: .byte 5, 4, 8

D2: .byte 6, 1, 5

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

1 ptsQuestion 11

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

LDI R18, 0x85

MOV R9, R18

ADD R9, R9

1 ptsQuestion 12

ID:q12EStudy 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, 7

2022/11/7 12:51 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 R3

subroutine1:
ADD R18 R20; Values for the registers after completion of this line of code a
re shown in the text below

Suppose at the start of the subroutine, R20 = 3;

Suppose near the end of the subroutine after completion of the line highlighted in
Red: R0=4, R2=5, R18=5

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

1 ptsQuestion 13

ID:q13AStudy the following program

It was generated by the compiler avr-gcc that uses the AVR libc library, so obeys
the convention for register management. The return address is assumed to
occupy 2 bytes in the activation stack.

LDI R20, 8
LDI R21, 7
LDI R22, 8
LDI R23, 3
LDI R24, 7
CALL subroutine1; Call the subroutine

2022/11/7 12:51 Quiz: ELEC1601_ELEC9601 End of Sem (practice)

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

subroutine1:
IN R31, 0x3E ; Z <- SP IN R30, 0x3D LDD R18, Z+4 LDD R19, Z+5 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 0x1231 subroutine1: ; This subroutine is at location 0xAB88 MOV R25, R8 CALL subroutine2 MOV R24, R7 ; result subroutine2: ; This subroutine is at location 0xAD84. 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/11/7 12:51 Quiz: ELEC1601_ELEC9601 End of Sem (practice) https://canvas.sydney.edu.au/courses/44479/quizzes/208463/take 12/12 1 ptsQuestion 15 Suppose you have a computer system with a 4 stage pipeline and clock period of Assuming there are no pipeline stalls (no branching, no I/O requests, no interrupts etc.), how long would it take to execute the following instructions: SUB R1 R4 Registers R1 to R4 are initialised to 5, 8, 5 and 4 respectively. Your answer should Submit Quiz 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com