1 / 118

Raymond Phan ENG 460 ee.ryerson/~rphan

COE 328 – Digital Systems and Microprocessors Lab 7 – Final Project Programmable Processor Module (PPM). Raymond Phan ENG 460 http://www.ee.ryerson.ca/~rphan. Outline of Lecture. Objectives Introduction Levels of abstraction Basic Computer Architecture

stesha
Télécharger la présentation

Raymond Phan ENG 460 ee.ryerson/~rphan

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COE 328 – Digital Systems and MicroprocessorsLab 7 – Final ProjectProgrammable Processor Module (PPM) Raymond Phan ENG 460 http://www.ee.ryerson.ca/~rphan

  2. Outline of Lecture • Objectives • Introduction • Levels of abstraction • Basic Computer Architecture • Overview of Customized Ryerson Microprocessor (CRM) • Datapath Unit on CRM • Architecture • Control Signals

  3. Outline of Lecture (2) • Instruction set on CRM • Details on each instruction available • Control Unit on CRM • Architecture • Control Signals • Procedure for Final Project • Preparing EPROM Files • Microinstructions  EPROM Format • Microinstruction Tables and Examples • Format for code and addressing • Conversion of EPROMs  .asc to .hex

  4. Outline of Lecture (3) • What you’re required to do • What’s due for marks • Format of Formal Lab Report • End… thank goodness right?

  5. Objectives • Get familiar with the basic elements that make up a microprocessor • Working with a microprocessor that Ryerson Profs designed many years ago • Derive the behaviour of the instruction set for a microprocessor (more on this later)

  6. Objectives (2) • Understand programs at the microprocessor level • You get to code your very own custom program at this level! • Things you need to know before we start: • Absolutely NO VHDL seen in this lab (yay?) • No more work on the CPLDs for this lab (bigger yay?) • Electrical guys  No more VHDL for the rest of your life (YAY!)… unless you want to get into digital design

  7. Objectives (3) • Also… don’t be scared! You might be scared of this project for the following reasons: • First time you’ll be programming at a lower level (lower than C or Java) • First time you’ll see the things that make up any microprocessor that exists today • You will be required to understand how exactly a microprocessor works.

  8. Outline of Lecture • Objectives • Introduction • Levelsof abstraction • Basic Computer Architecture • Overview of Customized Ryerson Microprocessor (CRM) • Datapath Unit on CRM • Architecture • Control Signals

  9. Introduction – Levels of Abstraction • Microprocessor on your computer is responsible for the execution of your program. • For any high-level language, when want to create an executable program, you use a compiler. • Compiler  Turns your high-level language statements into a format that the microprocessor can understand

  10. Introduction – Levels of Abstraction (2) • Here’s a nice drawing I made! • Very simple example  A = B + C; at the high level • On the microprocessor end, it does this addition by a form of instructions

  11. Introduction – Levels of Abstraction (3) • Example of the use of instructions: • Cooking! Let’s say you wanted to make scrambled eggs… how would you do it? • Crack eggs open and put them into bowl • Whip and beat them using a fork • Throw them on a pan and fry them

  12. Introduction – Levels of Abstraction (4) • This is EXACTLY the same as what the microprocessor is trying to accomplish on its end • Take a high – level language piece of code and you break it down into instructions • Processor carries out lines of code as a sequence of instructions

  13. Introduction – Levels of Abstraction (5) • Let’s look at the figure again: • You want to add the variables B and C and store them into the variable A • You could do this by registers and memory • All microprocessors that exist today have registers • Registers  Quick access memory storage elements for computation

  14. Introduction – Levels of Abstraction (6) • So, look at the diagram again: • Procedure on how to do A = B + C; • Load a register with the value stored in memory location B • Add the value of stored in memory location C to this register • Store this new value to memory location A

  15. Introduction – Levels of Abstraction (7) • But! The microprocessor can ONLY understand 0s and 1s! Look at the diagram again • Once you compile, your program is turned into a series of instructions • The assembler must now take these instructions and turn them into machine code (0s and 1s)

  16. Introduction – Levels of Abstraction (8) • Look at the diagram again below: • Look at the instructions. You can see that there are two things associated to it: The instruction, and the parameter for the instruction • LDR B  Use the load register command and load it with the contents of memory location B

  17. Introduction – Levels of Abstraction (9) • An instruction requires two pieces of information in order to execute • Opcode: The actual instruction itself (LDR, STR) • Operand: The parameter to this instruction (A, B, C) • This is pretty much like a function in C or Java  int number = gimmeSome(value);

  18. Introduction – Levels of Abstraction (10) • You could have instructions that have no operands at all, just the opcode. • C or Java equivalent = spaceCadet(); • Now back to the figure: • Look at the machine code part of the diagram • Takes the OpCode and Operand and turns them into 0s and 1s • Now, the microprocessor is ready to run the program

  19. Introduction – Levels of Abstraction (11) • Let me mess up your minds a bit: • Instructions like load, store, add, etc… these also need to perform instructions to perform the instructions! These are called micro-instructions • Here’s your time to go huh????? • Back to cooking example: • Scrambled Eggs: You’re performing micro-instructions without even knowing it!

  20. Introduction – Levels of Abstraction (12) • First step  Crack eggs and put them into a bowl. You need to do small things (microinstructions) in order to perform this step. What are they? • Get eggs out of fridge • Get bowl out of cupboard • Place both on the table • Hit eggs against surface • Crack open and place eggs into bowl

  21. Introduction – Levels of Abstraction (13) • Second step  Whip and beat the eggs with a fork. What’re the microinstructions? • Get the fork out of the cupboard • Grab a hold of the bowl • Use the fork and whip the eggs • Third step  Dump eggs into frying pan • Lift and hold the bowl • Turn it upside down and dump onto the frying pan

  22. Introduction – Levels of Abstraction (14) • So, what you’re doing when you’re cooking scrambled eggs is that you’re following instructions, but performing micro-instructions • Let’s throw this all together: • High Level Language  Open up a menu, tell the waiter you want scrambled eggs • Assembly Language  Chef makes scrambled eggs for you following instructions, performing micro-instructions • Machine Code  00101 001011, 11010 100111, 11011 100011, etc. etc.

  23. Outline of Lecture • Objectives • Introduction • Levels of abstraction • Basic Computer Architecture • Overview of Customized Ryerson Microprocessor (CRM) • Datapath Unit on CRM • Architecture • Control Signals

  24. Introduction – Basic Computer Architecture • The microprocessors in your computer, iPod, Cell Phone, PlayStation…etc. have 2 very important elements that make it up • Datapath Unit: • Handles manipulation and the movement of data in the microprocessor • Responsible for all mathematical and logical operations performed on variables • Has memory storage elements such as cache, registers, Static RAM

  25. Introduction – Basic Computer Architecture (2) • Control Unit: • How exactly do you tell the datapath unit that you want to perform an add, store, load? • Control Unit provides the proper signals that are fed to the datapath unit so it can perform the required operation • Example: Remote Control and TV • Remote Control  Control Unit • TV performing the desired operation  Done by Datapath Unit • So! Control Unit tells the datapath on what it should do and the Datapath Unit does the actual grunt work itself

  26. Outline of Lecture • Objectives • Introduction • Levels of abstraction • Basic Computer Architecture • Overview of Customized Ryerson Microprocessor (CRM) • Datapath Unit on CRM • Architecture • Control Signals

  27. Overview of the CRM - Introduction • Back in 1995 or so before: • I knew what the hell a computer was • You all knew what the hell a computer was • I was still sleeping at night with a night light…. Oops. • Ryerson profs developed a customized Microprocessor for this course so you guys know: • How a microprocessor works • The basic architecture of a microprocessor • How to program programs at the microprocessor level • To make your lives miserable because they probably weren’t married and want to take it out on you guys

  28. Overview of the CRM – Introduction (2) • They created and implemented their circuit designs for their customized microprocessor • CRM is physically implemented • Circuit is printed on a PCB (Printed Circuit Board) and is now ready for use • Let’s look at the datapath unit (don’t piss your pants… the circuit might look ugly)

  29. Overview of the CRM – Datapath Unit – Architecture • Here’s what it looks like! • Remember, Datapath does the grunt work • What do you see here? • Register (ACCA) • ALU • SRAM

  30. Overview of the CRM – Datapath Unit – Architecture (2) • Big Vertical Solid Line  Data Bus • Mechanism used to transfer data between entities • 4 bits wide • Only 2 things can be connected to the data bus at one time • Transmitter • Receiver • If you don’t follow this you’ll get a data clashing!

  31. Overview of the CRM – Datapath Unit – Architecture (3) • Register (Accumulator) • Call this accumulator because you have the ability to change the contents based on arithmetic or logical operations • Basically stores numbers after computation • Very special kind of register, a shift register. • Can use to load in a number, and you can also shift bits around, either to the left or the right

  32. Overview of the CRM – Datapath Unit – Architecture (4) • Arithmetic / Logic Unit • Used to do all arithmetic and logical operations on the microprocessor • Takes in 2 inputs, does logical or arithmetic operations on them and stores them into the accumulator • Output of the ALU is sent to the accumulator / shift register

  33. Overview of the CRM – Datapath Unit – Architecture (5) • Tri-State Bus Driver • Acts basically like a switch • Enables and Disables Output that it’s connected to • 4 bits wide

  34. Overview of the CRM – Datapath Unit – Architecture (6) • Input Switches • Can load numbers provided by you as well instead of just memory! • Switches take in an input number from the user and goes to the ALU for computation purposes • Connected to tri-state buffer to ensure no data clashing with other entities

  35. Overview of the CRM – Datapath Unit – Architecture (7) • Static RAM • Used to store numbers from the switches or the accumulator • Used to retrieve stored numbers for use in computing values • Output of RAM also serves as input to the ALU (note the Chip Select used for no data clashing) • 16 memory locations available for this Static RAM chip

  36. Overview of the CRM – Datapath Unit – Control Signals • Tri-State Bus Driver Control Signal Inputs • For the outputs of the accumulator and getting data from the switches, there is a control switch used to enable or disable the outputs • /AS – Accumulator Select • SM – Switches or Memory • /AS enables or disables the output of the accumulator • SM disables or enables the switches

  37. Overview of the CRM – Datapath Unit – Control Signals (2) • Static RAM Control Signal Inputs  • SM is used to disable and enable the RAM chip • This signal is shared between the RAM and the Switches • Note the active low / active high inversion on the switches and the RAM • /WE enables writing to a memory location or reading from a memory location on the chip • N3-0 selects the particular address in memory you want to access or write to.

  38. Overview of the CRM – Datapath Unit – Control Signals (3) • Accumulator Control Signal Inputs  • Note the Q3 and Q0, the MSB and LSB of the ACCA output! • C is for a carry-in into the register. • Since you’re performing arithmetic operations, you need a Carry-In, just like Lab 3 • CLK  Very important signal. You’ll see next • S1 and S0 control the way the contents of the accumulator are manipulated • S1 = 0, S0 = 0  Do not change the contents of the accumulator • S1 = 0, S0 = 1  Shift bits to the right at each clock cycle • S1 = 1, S0 = 0  Shift bits to the left at each clock cycle • S1 = 1, S0 = 1  Do a direct loading from D3-0

  39. Overview of the CRM – Datapath Unit – Control Signals (4) • ALU Control Signal Inputs • A and B are inputs into the ALU. You perform Arithmetic and Logic Operations on these two inputs • S3-0 are used to select the particular operation you want to perform on A and B • /CALU – Carry in into ALU (Same as Lab 3) • M selects whether you want to perform Arithmetic (M = 0) or Logic (M = 1) • /Co – Carry out from ALU • AEB - Flag goes high when B – A = 0

  40. Outline of Lecture • Objectives • Introduction • Levels of abstraction • Basic Computer Architecture • Overview of Customized Ryerson Microprocessor (CRM) • Datapath Unit on CRM • Architecture • Control Signals

  41. Outline of Lecture (2) • Instruction set on CRM • Details on each instruction available • Control Unit on CRM • Architecture • Control Signals • Procedure for Final Project • Preparing EPROM Files • Microinstructions  EPROM Format • Microinstruction Tables and Examples • Format for code and addressing • Conversion of EPROMs  .asc to .hex

  42. Overview of the CRM – Instruction Set • Instruction Set – The set of all instructions that you can perform on a microprocessor • The list of available instructions on the CRM is listed on page 5 of the lab7.pdf • Each instruction in the CRM needs: • Opcode: Actual instruction to perform • (Optional) Operand: Parameter to the instruction

  43. Overview of the CRM – Instruction Set (2) • ADDA N – Adds the accumulator with contents of memory location N and stores into accumulator (with the input carry to the accumulator) • OpCode: 0000 • Operand: N3N2N1N0 4 bit address in memory you want to access • SUBA N – Subtracts the accumulator with contents of memory location N and stores into accumulator (with the borrow bit to the accumulator) • OpCode: 0001 • Operand: N3N2N1N0 4 bit address in memory you want to access

  44. Overview of the CRM – Instruction Set (3) • INPA N – Takes a 4-bit binary number from the switches and puts this to the accumulator • OpCode: 0010 • Operand: None (Don’t Cares  N3N2N1N0 = xxxx) • LDAA N – Loads the accumulator with contents of memory location N • OpCode: 0011 • Operand: N3N2N1N0 4 bit address in memory you want to access

  45. Overview of the CRM – Instruction Set (4) • STAA N – Store the contents of the accumulator and store it into memory location N. • OpCode: 0100 • Operand: N3N2N1N0 4 bit address in memory you want to access • JMP N – Jump to instruction number (address) N in your program • OpCode: 0101 • Operand: N3N2N1N0 4 bit address in your program that you want to jump to • Note, to implement a program using this instruction, you can only have maximum 16 lines of code!

  46. Overview of the CRM – Instruction Set (5) • Something you need to know  We could have two instructions with the same OpCode, but have the Operand be used to distinguish instructions from one another! (Don’t cares are 1 (x = 1)) • ADDA S – Adds the accumulator with the input number seen at the switches and stores into accumulator (with the input carry to the accumulator) • OpCode: 0110 • Operand: N3N2N1N0 xxx0  N0 = 0 to perform addition • SUBA S – Subtracts the accumulator with the input number seen at the switches and stores into accumulator (with the borrow bit to the accumulator) • OpCode: 0110 • Operand: N3N2N1N0 xxx1  N0 = 1 to perform subtraction

  47. Overview of the CRM – Instruction Set (6) • ANDA N – Performs the logical AND operation with the accumulator and whatever contents are in memory location N and stores the result in the accumulator • OpCode: 0111 • Operand: N3N2N1N0 4 bit address in memory you want to access • CLC – Clears the input carry bit in the accumulator • OpCode: 1000 • Operand: N3N2N1N0 xxx0  N0 = 0 to perform clear

  48. Overview of the CRM – Instruction Set (7) • SEC – Sets the input carry bit in the accumulator • OpCode: 1000 • Operand: N3N2N1N0 xxx1  N0 = 1 to perform set • DECA – Decrement the accumulator (ACCA = ACCA – 1) • OpCode: 1001 • Operand: N3N2N1N0 xxx0  N0 = 0 to perform decrement

  49. Overview of the CRM – Instruction Set (8) • INCA – Increment the accumulator (ACCA = ACCA + 1) • OpCode: 1001 • Operand: N3N2N1N0 xxx1  N0 = 1 to perform increment • RORA – Rotate the Accumulator 1 bit to the right (MSB of accumulator = C and LSB of accumulator = C) • OpCode: 1010 • Operand: N3N2N1N0 xxx0  N0 = 0 to perform right rotate

  50. Overview of the CRM – Instruction Set (9) • ROLA – Rotate the Accumulator 1 bit to the left (LSB of accumulator = C and C = MSB of accumulator) • OpCode: 1010 • Operand: N3N2N1N0 xxx1  N0 = 1 to perform left rotate • STSW N  Take a number from the input switches and store it into memory location N • This combines two operations: INPA and STAA N • OpCode: 1011 • Operand: • 1st step  Operand = xxxx  Number to place into accumulator comes from switches • 2nd step  N3N2N1N0 Memory location to store input switch value to

More Related