Presentation is loading. Please wait.

Presentation is loading. Please wait.

EE345 Chapter 2 Lecture 3 April 4. Quiz every Wednesday 1 quiz = 1% extra credit five quizzes before midterm  5% for midterm. five quizzes before final.

Similar presentations


Presentation on theme: "EE345 Chapter 2 Lecture 3 April 4. Quiz every Wednesday 1 quiz = 1% extra credit five quizzes before midterm  5% for midterm. five quizzes before final."— Presentation transcript:

1 EE345 Chapter 2 Lecture 3 April 4

2 Quiz every Wednesday 1 quiz = 1% extra credit five quizzes before midterm  5% for midterm. five quizzes before final exam  5% for final exam. each quiz: 2 to 3 problems, 10 to 15 mins; review quiz problems. turn in (corrected version if there are any mistakes) perfect answers on following Monday. receive 1%.

3 Take quiz (10 to 15 mins) on Wednesday review quiz problems together in class (5 to 10 mins) turn in perfect quiz on following Monday receive 1% of extra credit

4 Levels of Programming Languages High level ex. C, C++, Java, JavaScript, C#, … Assembly Language 68HC11, MIPS, ARM, … machine code c=3; d = c + a; LDAA $34 ABA 01101010111010101011101 01001010111010101011110 (NA) We like Computer likes

5 Storage - Memory

6 Working station - CPU

7

8 2.1 The 68HC11 Computer Operation Processor Model Memory Model D X Y A SP B PC SXHINZV N B6 C1 33 22 0000 C23A C23B FFFF C239 (P.50)

9 The Programming Model Some terms A computer is a collection of registers and some other hardware that manipulate numbers and move numbers around among those registers. mnemonic is an abbreviation or symbol designed to make the abbreviation easy to remember. (P51) syntax: in wiki, the arrangement of words and phrases to create well-formed sentences in a language. Format (grammar) of command. instruction: command to create an operation (in assembly level). (P.50)

10 The Programming Model D (16 bits) X Y A (8 bits) SP B (8 bits) PC 8-bit accumulators A & B 16-bit accumulator D Index Register X Index Register Y Stack Pointer Program Counter Condition Code Register SXHINZV C (P.50) Figure 2-1 Motorola 68HC11 programming model.

11 An Instruction Format B6 C1 33 22 0000 Figure 2-2 Memory model. C23A C23B FFFF C239 (P.51)

12 An Instruction Format (another example) FF D3 11 B6 C1 33 22 0000 Another Example of Memory model. FFFF NA 0001 0002 0003 0004 0005

13 B6 C2 00 22 C100 Figure 2-3 Example of an instruction code – Load Accumulator A. C102 C200 C101 Op code of LDAA Operand: value or address of data (it’s address in this instruction) Data number (P.52)

14 The Microprocessor Model Accumulators. A general-purpose register in a microprocessor that holds a data number. the data is created by an instruction Program Counter. The microprocessor register that holds the address of the next instruction to be fetched from memory. Instruction register. The register in the microprocessor that holds an instruction code number as it is fetched from memory. (P.52)

15 The Microprocessor Model PC IR A B Figure 2-4 The Microprocessor model. (P.53)

16 B6 C2 00 44 C100 Figure 2-5 Programming model with an instruction in memory. C102 C200 C101LDAA (P.54) C100 22 33 IR A B PC

17 Instruction fetch B6 C2 00 44 C100 Figure 2-6 Beginning of the fetch phase of an instruction. C102 C200 C101LDAA C100 22 33 IR A B PC (P.55)

18 B6 C2 00 44 C100 Figure 2-7 First byte of instruction has been fetched. C102 C200 C101LDAA C100 B6 22 33 IR A B PC (P.50)

19 B6 C2 00 44 C100 Figure 2-8 The second byte of the instruction has been fetched. C102 C200 C101LDAA C101 B6 22 33 IR A B PC (P.56)

20 B6 C2 00 44 C100 Figure 2-9 The second byte of the instruction has been fetched. C102 C200 C101LDAA C101 B6C2 22 33 IR A B PC (P.56)

21 B6 C2 00 44 C100 Figure 2-10 The program counter has been incremented after the second clock tick. C102 C200 C101LDAA C102 B6C2 22 33 IR A B PC (P.57)

22 B6 C2 00 44 C100 Figure 2-11 The third byte of the instruction has been fetched. C102 C200 C101LDAA C102 B6C200 22 33 IR A B PC (P.57)

23 B6 C2 00 44 C100 Figure 2-12 The fetch operation is complete after the third clock tick. C102 C200 C101LDAA C103 B6C200 22 33 IR A B PC (P.58)

24 B6 C2 00 44 C100 Figure 2-13 The data number has been put into the accumulator. C102 C200 C101LDAA C103 B6C200 44 33 IR A B PC (P.59)

25 B6 C2 00 44 C100 Figure 2-14 At the completion of LDAA instruction after four clock ticks. C102 C200 C101LDAA C103 B6C200 44 33 IR A B PC (P.59)

26 Instruction set table Source FormOperationBoolean Expression Machine Code Bytes Op CodeOperand ADDA Add Memory to A A + M  A BBhh ll3 LDAA Load Accumulator A M  A B6hh ll3 STAA Store Accumulator A A  M B7Hh ll3 STOP Stop program in trainer 3F 1 (P.60-61) Operation: description Boolean Expression: logical expression Machine Code Op Code Machine Code Operand Bytes The table on page 13 in Motorola 68HC11 manual.

27 Machine Language: the binary numbers that form a program in the memory of the computer are called machine language. Program loading: put the instructions numbers and data numbers into the memory.

28 Use manual to work on this type of problems B6 C2 0B BB C2 0C B7 C2 C200 C202 C206 C201 LDAA 0D 3F 02 29 FF ADDA (P.63) Figure 2-16 The first machine language program. (At very beginning, hasn’t fetched yet.) STAA STOP N1 N2 N3 instructions data C203 C205 C204 C207 C209 C208 C20A C20C C20B C20D C20F C20E C210 C200 FF A B PC FF here are some arbitrary data generated from previous instructions

29 B6 C2 0B BB C2 0C B7 C2 C200 C202 C206 C201 LDAA 0D 3F 02 29 FF ADDA (P.64) Figure 2-17 Machine Language program – one instruction executed STAA STOP N1 N2 N3 instructions labels C203 C205 C204 C207 C209 C208 C20A C20C C20B C20D C20F C20E C210 C203 02 FF A B PC

30 B6 C2 0B BB C2 0C B7 C2 C200 C202 C206 C201 LDAA 0D 3F 02 29 FF ADDA (P.64) Figure 2-18 Machine Language program – two instructions executed STAA STOP N1 N2 N3 instructions labels C203 C205 C204 C207 C209 C208 C20A C20C C20B C20D C20F C20E C210 C206 2B FF A B PC

31 B6 C2 0B BB C2 0C B7 C2 C200 C202 C206 C201 LDAA 0D 3F 02 29 2B ADDA (P.65) Figure 2-19 Machine Language program – three instructions executed STAA STOP N1 N2 SUM instructions labels C203 C205 C204 C207 C209 C208 C20A C20C C20B C20D C20F C20E C210 C209 2B FF A B PC


Download ppt "EE345 Chapter 2 Lecture 3 April 4. Quiz every Wednesday 1 quiz = 1% extra credit five quizzes before midterm  5% for midterm. five quizzes before final."

Similar presentations


Ads by Google