Presentation is loading. Please wait.

Presentation is loading. Please wait.

Comparing 68k (CISC) with 21k (Superscalar RISC DSP)

Similar presentations


Presentation on theme: "Comparing 68k (CISC) with 21k (Superscalar RISC DSP)"— Presentation transcript:

1 Comparing 68k (CISC) with 21k (Superscalar RISC DSP)
* 07/16/96 This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep track of these action items during your presentation In Slide Show, click on the right mouse button Select “Meeting Minder” Select the “Action Items” tab Type in action items as they come up Click OK to dismiss this box This will automatically create an Action Item slide at the end of your presentation with your points entered. Comparing 68k (CISC) with 21k (Superscalar RISC DSP) M. R. Smith, Electrical and Computer Engineering University of Calgary, Alberta, Canada ucalgary.ca *

2 ENCM515 -- Compare 68k and 21k Copyright smithmr@ucalgary.ca
To be tackled today When to use assembly code Useful sub-set of 68K CISC instructions Recap Effective addressing modes Load/Store Programming style for 68K Load/Store Architecture of 21K by comparison with 68K 12/31/2018 ENCM Compare 68k and 21k Copyright

3 ENCM515 -- Compare 68k and 21k Copyright smithmr@ucalgary.ca
“Reminder” Reuse the following ENCM415 concepts Don’t use “Assembly Code” unless “really have” to Write in “C/C++” whenever appr0priate Connect to the hardware “in assembler” using instructions that always work -- RISC-like (MIPS) Understand linkages between “assembly” and “C” Customize “C” only when necessary ENCM515 Basic requirement for “Custom DSP” code -- need to know features of processor Recognize that speed comes from instructions that work only under special conditions because of processor architectural constraints -- opcode size, bus availability 12/31/2018 ENCM Compare 68k and 21k Copyright

4 ENCM515 -- Compare 68k and 21k Copyright smithmr@ucalgary.ca
Very limited set of instructions used in Assembly Code most of the time Operational Instructions MOVE ADD, SUB (FADD, FSUB) AND, OR Program Flow BRA, JMP, JSR, RTS, TRAP CMP, BNE, BEQ BHI, HLO, BLS (unsigned branches) BGE, BLT, BGT (signed branches) 12/31/2018 ENCM Compare 68k and 21k Copyright

5 Easiest way to program 68K in assembly
Have a PSP process to avoid the stupid mistakes that stop you getting to the stuff that is worth doing Never bother with the complex EA-mode instructions Don’t gain much any way Program CISC as if had “LOAD/STORE” architecture like the MIPS processor MOVE memory to register (LOAD) MOVE register to memory (STORE) OPERATE register on register Plus a few other non-RISC instructions that you find very useful to use (e.g. ADD.L #5, D0) Customize for speed later -- if it is worth the effort 12/31/2018 ENCM Compare 68k and 21k Copyright

6 Easiest way to program 21k in assembly
Have a PSP process to avoid the stupid mistakes that stop you getting to the stuff that is worth doing Never bother with the complex EA-mode instructions Don’t gain much any way Program Superscalar RISC DSP which has “LOAD/STORE” architecture like the MIPS processor PLUS DSP-special MOVE memory to register (LOAD) MOVE register to memory (STORE) OPERATE register on register Plus a few other non-RISC instructions that you find very useful to use (e.g. ADD.L #5, D0) Customize for speed later -- if it is worth the effort 12/31/2018 ENCM Compare 68k and 21k Copyright

7 Some of the effective address modes for 68k MOVE
Register to Register -- RISC like MOVE.L D1, D0 [D0] <- [D1] (31:0) Immediate to Register -- RISC like MOVE.L #0x5000, D1 [D1] <- 0x5000 (31:0) Memory to Register -- RISC like MOVE.L 0x5000, D1 [D1] <- [M(0x5000)] (31:0) Memory to Memory -- CISC MOVE.L 0x5000, 0x [M(0x6000)] <- [M(0x5000)] (31:0) 21k equivalent R0 = R1; 21k equivalent R1 = 0x5000; 21k equivalent R1 = dm(0x5000); 21k equivalent 4 animations 12/31/2018 ENCM Compare 68k and 21k Copyright

8 Some of the effective address modes for ADD
* 07/16/96 Register to Register -- RISC like ADD.L D1, D0 [D0] <- [D0] + [D0] Immediate to Register -- CISC ADD.L #0x5000, D1 [D1] <- [D1] + 0x5000 Memory to Register -- CISC ADD.L 0x5000, D1 [D1] <- [D1] + [M(0x5000)] Memory to Memory -- CISC ADD.L 0x5000, 0x illegal on 68K [M(0x6000)] <- [M(0x6000)] + [M(0x5000)] animations 21k equivalent R0 = R0 + R1; 21k equivalent 21k illegal too 12/31/2018 ENCM Compare 68k and 21k Copyright *

9 Basic LOAD/STORE operations
CAREFULL!!!! 21k -- NOT QUITE LOAD -- Memory to register [Reg] <- [Memory(address)] MOVE.L 0x5000, D1 R1 = dm(0x5000); [D1] <- [Memory(0x5000)] R1 = pm(0x5000); F1 = dm(0x5000); STORE -- Register to Memory [Memory(address)] <- [Reg] MOVE.L D1, 0x5000 dm(0x5000) = R1; [Memory(0x5000)] <- [D1] pm(0x5000) = R1; 12/31/2018 ENCM Compare 68k and 21k Copyright

10 Basic LOAD/STORE operations
LOAD register with a constant [Reg] <- constant value MOVE.L #0x5000, D1 R1 = 0x5000; [D1] <- 0x5000 CAREFULL!!!! 21k -- NOT QUITE 12/31/2018 ENCM Compare 68k and 21k Copyright

11 Basic Register-to Register operations
CAREFULL!!!! 21k -- NOT QUITE LOAD -- Register to register [Reg] <- [Reg2] MOVE.L D1, D0 R0 = R1; [D0] <- [D1] Sometimes R0 = pass R1; is better Operation -- Register to register [Reg] <- [Reg] Operation [Reg2] ADD.L D1, D R0 = R1 + R2; [D0] <- [D0] + [D1] is also possible on 21k 12/31/2018 ENCM Compare 68k and 21k Copyright

12 Basic 68k Register-to Register operations
Operation -- Register to register [Reg] <- [Reg] Operation [Reg2] ADD.L D0, D [D1] <- [D1] + [D0] SUB.L D0, D [D1] <- [D1] - [D0] AND.L D0, D [D1] <- [D1] & [D0] OR.L D0, D [D1] <- [D1] | [D0] CMP.L D0, D [BB] <- [D1] - [D0] ASR #3, D0 [D0] <- [D0] >> 3 (signed) LSR #3, D0 [D0] <- [D0] >> 3 (unsigned) 12/31/2018 ENCM Compare 68k and 21k Copyright

13 Basic 21k Register-to Register operations
Operation -- Register to register [Reg] <- [Reg1] Operation [Reg2] [D1] <- [D2] + [D0] [D1] <- [D1] - [D2] [D1] <- [D1] & [D2] [D1] <- [D1] | [D2] Compare [D0] <- [D0] >> 3 (signed) [D0] <- [D0] >> 3 (unsigned) YOU COMPLETE 12/31/2018 ENCM Compare 68k and 21k Copyright

14 Basic 21k Register-to Register operations
YOU COMPLETE 12/31/2018 ENCM Compare 68k and 21k Copyright

15 Basic Indirect Addressing Operations to Memory
CAREFULL!!!! 21k -- NOT QUITE LOAD INDIRECT [Reg] <- [Memory([AddressReg2])] R1 = dm(0, I4); MOVE.L (A0), D0 R1 = dm(I4, 0) ; [D0] <- [Memory([A0])] R1 = pm(I12, 0); R1 = dm(I12, 0); NO! LOAD INDIRECT with CONSTANT offset [Reg] <- [Memory([AddressReg2 + offset])] MOVE.L (8, A0), D0 R1 = dm(2, I4); [D0] <- [Memory([A0] + 8)] R1 = dm(I4, 2) ; NO! Same with store operations 12/31/2018 ENCM Compare 68k and 21k Copyright

16 Indirect Addressing Operations to Memory
LOAD INDIRECT with Register offset [Reg] <- [Memory([AddressReg2 + offset])] R0 = dm(R1, I4); NO!! MOVE.L (A0,D1), D R0 = dm(M4, I4); [D0] <- [Memory([A0] + [D1])] R1 = dm(I4, M4); NO!! R1 = pm(M12, I12); R1 = pm(M4, I12); NO!! Same with store operations LOAD INDIRECT with Register + constant offset [Reg] <- [Memory([AddressReg2 + offset1 + offset 2])] MOVE.L (8, A0, D1), D0 NO!! [D0] <- [Memory([A0] + [D1] + 8)] CAREFULL!!!! 21k -- NOT QUITE 12/31/2018 ENCM Compare 68k and 21k Copyright

17 Indirect Addressing Operations to Memory
LOAD INDIRECT with register post-increment [Reg] <- [Memory([AddressReg2])] [AddressReg2] <- [AddressReg2] + 4 MOVE.L (A0)+, D R0 = dm(I4, 1); [D0] <- [Memory([A0])] ; [A0] <- [A0] + 4 LOAD INDIRECT with register pre-decrement [AddressReg2] <- [AddressReg2] - 4 [Reg] <- [Memory([AddressReg2])] Modify (I4, -1); MOVE.L -(A0), D0 R0 = dm(0, I4); [A0] <- [A0] - 4 ; [D0] <- [Memory([A0])] 12/31/2018 ENCM Compare 68k and 21k Copyright

18 ENCM515 -- Compare 68k and 21k Copyright smithmr@ucalgary.ca
21k processor is DSP Digital Signal Processing Processor Customized for DSP In real life, programmer must be really close to the architecture if want speed However most of the time, treat like a version of the 68K 12/31/2018 ENCM Compare 68k and 21k Copyright

19 ENCM515 -- Compare 68k and 21k Copyright smithmr@ucalgary.ca
Compare MOVE on 29K and 68K Register to Register R1 = R MOVE.L D0, D1 Immediate to Register R0 = 0x MOVE.L #0x5000, D0 Memory to Register R0 = dm(0x5000) MOVE.L 0x5000, D0 R0 = pm(0x5000) No equivalent --- Memory to Memory -- No equivalent MOVE.L 0x5000, 0x6000 12/31/2018 ENCM Compare 68k and 21k Copyright

20 Comparing ADD operations
Register to Register R1 = R1 + R0 ADD.L D0, D1 Immediate to Register -- No equivalent ADD.L #0x5000, D0 Memory to Register -- No equivalent ADD.L 0x5000, D0 Memory to Memory Not available on EITHER processor 12/31/2018 ENCM Compare 68k and 21k Copyright

21 Easiest way to program 21K assembly
Can’t bother with the complex instructions DSP has “LOAD/STORE” architecture like the MIPS processor MOVE memory to register (LOAD) MOVE register to memory (STORE) OPERATE register on register There are not any other type of instructions Customize for speed later using hardware Develop a process to avoid the standard simple errors so that you can get to the stuff that is important. Most of you will not bother to use the process for 5 minutes in order to avoid wasting 1 hour of time 12/31/2018 ENCM Compare 68k and 21k Copyright

22 Basic LOAD/STORE operations
LOAD -- Memory to register [Reg] <- [Memory(address)] R0 = dm(0x5000) MOVE.L 0x5000, D0 STORE -- Register to Memory [Memory(address)] <- [Reg] pm(0x5000) = R0 no 68k equivalent for pm 12/31/2018 ENCM Compare 68k and 21k Copyright

23 Basic LOAD/STORE operations
LOAD register with a constant [Reg] <- constant value R0 = 0x5000 MOVE.L #0x5000, D0 12/31/2018 ENCM Compare 68k and 21k Copyright

24 Basic Register-to Register operations
LOAD -- Register to register [Reg] <- [Reg2] R0 = R1 MOVE.L D1, D0 Operation -- Register to register [Reg] <- [Reg] Operation [Reg2] R1 = R1 + R0 ADD.L D0, D1 R1 = R2 + R3 -- no equivalent -- 12/31/2018 ENCM Compare 68k and 21k Copyright

25 Basic Register-to Register operations
Operation -- Register to register [Reg] <- [Reg] Operation [Reg2] R1 = R1 + R0 ADD.L D0, D1 R1 = R1 - R0 SUB.L D0, D1 R1 = R1 AND R0 AND.L D0, D1 R1 = R1 OR R0 OR.L D0, D1 -- many alternatives -- CMP.L D0, D1 12/31/2018 ENCM Compare 68k and 21k Copyright

26 Basic Indirect Addressing Operations to Memory
LOAD INDIRECT [Reg] <- [Memory([AddressReg2])] R0 = dm(I0) MOVE.L (A0), D0 LOAD INDIRECT with CONSTANT offset [Reg] <- [Memory([AddressReg2 + offset])] R0 = dm(2, I4) MOVE.L (8, A0), D0 but R0 = pm(2, I12) -- No need for distinction -- Special DAGS for custom data and program memory ops 12/31/2018 ENCM Compare 68k and 21k Copyright

27 Indirect Addressing Operations to Memory
LOAD INDIRECT with Register offset [Reg] <- [Memory([AddressReg2 + offset])] R0 = dm(M4, I4) MOVE.L (A0,D1), D0 Order is absolutely key -- dm(I4, M4) means something VERY different Same with store operations LOAD INDIRECT with Register + constant offset [Reg] <- [Memory([AddressReg2 + offset1 + offset 2])] -- NO Equivalent MOVE.L (8, A0, D1), D0 but wait till Lab. 2, 3 and 4 for some REALLY fancy SHARC addressing modes 12/31/2018 ENCM Compare 68k and 21k Copyright

28 Indirect Addressing Operations to Memory
LOAD INDIRECT with register post-increment [Reg] <- [Memory([AddressReg2])] [AddressReg2] <- [AddressReg2] + 4 R0 = dm(I4, M6) MOVE.L (A0)+, D0 (with M6 preset to 1) R0 = dm(I4, 1) -- An instruction that is only useful on a Monday/Weds and our labs are on Friday and exams on Tues! LOAD INDIRECT with register pre-decrement R0 = dm(I4, M7) MOVE.L -(A0), D0 (with M7 preset to -1) R0 = dm(I4, -1) -- Only useful on a Monday/Weds R0 = dm(I4, M15) illegal but R0 = pm(I12, M15) is OKAY 12/31/2018 ENCM Compare 68k and 21k Copyright

29 ENCM515 -- Compare 68k and 21k Copyright smithmr@ucalgary.ca
You complete // long int value = 6; // Memory[2000] = value; // Memory[3000] = 7; // long int pt = &Memory[4000]; // *pt = value; // *pt = 9; // *pt++ = value + 1; // *pt-- = value + 2; 12/31/2018 ENCM Compare 68k and 21k Copyright

30 Fix RISC architecture and speed Issues
#define valueR1 R1 valueR1 = 6; // long int value = 6; dm(2000) = value; // Memory[2000] = value; #define tempR0 R0 tempR0 = 7; dm(2000) = tempR0; // Memory[3000] = 7; #define ptI4 I4 // long int pt = &Memory[4000]; ptI4 = 4000; dm(ptI4) = value; // *pt = value; tempR0 = 9; // *pt = 9; dm(ptI4, M5) = tempR0; // M4 preset to 0 by C start-up procedure #define tempR2 R2 tempR2 = valueR1 + 1; // *pt++ = value + 1; dm(ptI4, M6) = tempR2; // M6 preset to +1 by C startup procedure tempR0 = 2; // *pt-- = value + 2; tempR2 = tempR1 + tempR0; dm(pt4, M7) = tempR2 // M7 preset to -1 by C startup procedure 12/31/2018 ENCM Compare 68k and 21k Copyright

31 ENCM515 -- Compare 68k and 21k Copyright smithmr@ucalgary.ca
NON-NEGIOTABLE NON-NEGIOTABLE -- means that is the way the processor is designed and you can’t fight it NON-NEGIOTABLE -- means that is you don’t do it this way you will waste a lot of time in the labs on the simple stuff -- and lose many marks in quizzes NON-NEGIOTABLE -- means that this is fixed, standard, life. Develop a simple PSP process to review code to make sure this stuff is not there and you can get onto the interesting stuff. CONTRACT -- The moment the class stops making 80% of these simple errors, I will stop taking most marks off in the quizzes for the simple stuff. 12/31/2018 ENCM Compare 68k and 21k Copyright

32 ENCM515 -- Compare 68k and 21k Copyright smithmr@ucalgary.ca
Tackled today When to use assembly code Useful sub-set of 68K CISC instructions Recap Effective addressing modes Load/Store Programming style for 68K Load/Store Architecture of 21K by comparison with 68K 21K architecture is customized for DSP 12/31/2018 ENCM Compare 68k and 21k Copyright


Download ppt "Comparing 68k (CISC) with 21k (Superscalar RISC DSP)"

Similar presentations


Ads by Google