NAME ______ID # ______

ENEL415 Post-Lab #2 Quiz B 20th October 1998

This is a closed book exam, except that students may make use of their OWN, CLEAN copies of the Motorola 68000 processor and SDS Quiz 1 reference cards.

Answer in the space provided. Please ensure that you answer the question asked and not the question you think was asked. Provide appropriate documentation/explanation for your code and answers.

After completing each question, write in this table what you believe will be the mark you will receive for that question. This will allow me to keep track of student expectations

Question Number / Maximum Mark Available / Student Mark Estimate / Actual Mark
Awarded by T.A.
Q1 / 12 / / 12 / / 12
Q2 / 13 / / 13 / / 13
Q3 / 12 / / 12 / / 12
BONUS Q4 / BONUS 2 / BONUS / 2 / BONUS / 2
Q5 / 13 / / 13 / / 13

Total Marks

/ 50 / / 50 / / 50

Don’t forget to use the answer sheet handed out at the end of the quiz to calculate your estimated mark for this quiz. Use that information, and your estimated marks from the Pre-lab quiz and the Laboratory itself to update your Earned Mark Analysis Sheet. Follow the information on the web about what needs to be submitted by the web (by Thursday) and handed in (Friday morning 9 am in class)

Q1) For this question, you will need to write on the image from the SDS simulator that is provided as a separate sheet 2 marks each for a total of 12 marks

A)Circle, and label with an A, the button/menu option that will allow you to assemble a file

B)Circle, and label with a B, the button/menu option that allows downloading of an executable

C)Circle, and label with a C, the button/menu option that leads you to being able to change the C++ compiler options from –Odg to –Od

D)Circle, and label with a D, the byte(s) stored in ROM and associated with the op-code for the instruction starting at memory location 0x1022

E)Circle, and label with an E, the byte(s) stored in ROM and associated with describing the destination for the instruction starting at memory location 0x101A

F)Circle, and label with an F, the byte(s) stored in ROM and associated with describing the source for the instruction starting at memory location 0x1028

Q2) I promised one day inclass a special question for all those that attended that class where I went over the RTL and Data/Address Bus traffic for a JSR instruction, such as the one at memory location 0x1022 on the SDS image. Those people who have made up the class by looking at the web pages should also have no problem with this question. Read it carefully. Parts A, B and C provide some hints for Part D

A) Complete the following sentences that are taken from page 5.1 of the M68000 Microprocessors User’s Manual 1 mark each for a total of 3 marks

Transfer of data between devices involves the following signals
  • The ______bus signals involving the lines A23 to A1
  • The ______bus signals involving lines such as DTACK* , AS* and R/W*
  • The ______bus signals involving the lines D15 to D0

B) During which PHASE of an instruction on the 68K processor is there not likely to be any useful activity on the ADDRESS or DATA busses? 1. 5 Marks

C) What is the PHASE of an instruction that occurs JUST BEFORE the DECODE phase?

1.5 Marks

D) Look at the JSR instruction that starts at memory location 0x1022.

Complete the timing diagram below for the 68K processor for the FETCH PHASE of the instruction. Show the values on the Address and Data busses, and READ/WRITE* LINES. There are marks given showing the proper relationship to the MICROPROCESSOR CLOCK SIGNAL. I have marked the +5V and 0V logic levels for you for R/W* signal

7 marks

MICROPROCESSOR CLOCK SIGNAL – 8 MHz

ADDRESS BUS

DATA BUS

READ/WRITE*+5V Level

0V Level

Q3. I have provided you with the “C/C++” code for a simple code segment. Translate the code into 68K code using the ideas that you have got from labs 1 and 2. Don’t worry about things like “stack” and “volatile and non-volatile” registers as this is a CODE SEGMENT rather than a stand-alone FUNCTION. You may need one of more lines of assembly code for each “C/C++” statement or you may need less. Don’t do code optimizations such as giving me the final answer. I’m marking your translation capability. 12 marks

; signed long int sum;
; signed char count;
; long int temp_value
; HINT: If it does not say unsigned then the “C/C++” automatically makes it signed
; sum = 0;
; count = 5;
; while (count >= -6) {
; temp_value = (long int) count;
; HINT: That’s “C/C++” language for doing a conversion between variable types
; sum = sum + temp_value;
; count = count – 4;
; }
; sum = sum / 6;

Q4) A very simple question, but it involves understanding a lot about RTL and how the processor works and stores things. I would expect less than 20% of the class will get full marks so it is not worth many marks. BONUS 1 mark for each question – total 2 marks

Look at the SDS image for the instructions starting at location 0x101A. The assembler accepted it – so it is a perfectly valid, if unusual looking.

MOVE.B 0x1234.W, 0x12345678.L

A) What does the .B extension mean?______

B) What does the .W extension mean? ______

Q5 – Design component of Post-Lab Quiz 2 – Be careful and make sure that you read the question properly and answer the question properly and in the fashion requested. 13 marks

I am building the motor controller for an automatic tooth brush. The motor powers up to full speed, rotates for 40 turns and then revolves in the other direction. It does this two directional motion 100 times before stopping. The controller device has a base address of 0x10000. The information about the device registers is given below.

Design and provide DETAILED pseudo-code segment to solve this design problem – don’t worry about doing the motion 100 times – just code for once forward and leave it at that. I am awarding NO MARKS for any assembly code – this is simply a design problem which leads to “pseudo-code” having the same sort of detail as was given for Q3 in this exam. I would prefer that you use POINTERS when coding.

CONTROL_REGEQU 0x10; 16-bit register -- Offset from device baseaddress

RESET_BITEQU 0x1000; Reset/Enable bit for the device

MOTOR_REGEQU 0x20; 16-bit register – Offset from device baseaddress

ONEQU 0xC0; Values written to the MOTOR_REG control the

OFFEQU 0x00; speed of the motor rotation

DIRECTION_REG EQU 0x30; 16-bit register – Offset from device baseaddress

FORWARD EQU 2; Values written to the DIRECTION_REG control

BACKWARD EQU 1; the direction of the motor

COUNTER_REG EQU 0x40;16-bit register – Automatically becomes 1 after 40

; turns of the motor in one direction have occurred. After you have read a value 1 from this register

; it automatically becomes 0 and you don’t need to set/reset this register. Many device registers

; work in this fashion. Simply read this register. If it is a 1, then make the motor must turn the other way