































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The Assembler Programming and Computer Organization, is very helpful series of lecture slides, which made programming an easy task. The major points in these laboratory assignment are:Programming Pic Micro Controller, Memory Locations, Low Pin Count Demo Board, Demo Board, Development Process, Perfect Code, Demo Board Working, Description of Tools and References, Windows TypesProcessors, Instruction Set Architecture Design, Memory Addressing Modes, Instruction-Level Pipelining, Execution Perform
Typology: Slides
1 / 71
This page cannot be seen from the preview
Don't miss anything!
Byte ordering, or endedness , is a major architectural consideration.
gcc -g quickie.c – o quickie quickie od -b Tempfile 003 000 000 000 021 000 000 000 001 002 000 000 – Chapter 5: Processors – 5
#include <stdio.h> #include <stdlib.h> #include <string.h>
*typedef struct { int val1; int val2; int val3; } RECORD; main() { RECORD r; FILE FOutput;
*r.val1 = 3; r.val2 = 17; r.val3 = 513; FOutput = fopen( "Tempfile", "w" ); fwrite( (char )(&r), sizeof(RECORD), 1, FOutput ); fclose( FOutput ); }
This shows a small program that writes data to a file. What’s unusual here is that the data written is three integers. Note how this data is laid out in the file.
General purpose register (GPR) architecture, registers used instead of memory.
In a one-address ISA, like PIC, the expression, Z = X Y + W U looks like this: movfw X mult Y ; We haven’t seen mult movwf TEMP movfw W mult U add TEMP movwf Z
Accumulator Machines
In a CISC GPR, (e.g.,Intel), the expression, Z = X Y + W U might look like this: LOAD R1,X MULT R1,Y LOAD R2,W MULT R2,U ADD R1,R STORE Z,R
CISC GPR
With a three-address ISA, (MIPS), the expression,
Z = X Y + W U might look like this: LW R1, X LW R2, Y MULT R3, R1, R LW R4, W LW R5, U MULT R6, R4, R ADD R3, R3, R SW R3, Z
3-Address RISC GPR
Instructions fall into several broad categories that you
should be familiar with:
Can you think of some examples of each of these?
Immediate addressing is where the data is part of the instruction. In PIC Assembly movlw 0x27 moves the hex value 0x27 into the accumulator – the 0x27 was stored in the instruction.
Register addressing is where the data is located in a register. In MIPS Assembly, add R6, R1, R2 , we’re adding the data that’s in register R1 to the data that’s in register R2 and putting the sum into register R6.
Direct addressing is where the address of the data is given in the instruction. In PIC Assembly, movfw Addr says to move the data stored at location Addr into the accumulator. An equivalent MIPS instruction is lw R5, Addr - move the contents of Addr into R
Indirect addressing gives the address of the
address of the data in the instruction. The PIC Assembler uses this mode: movlw 0x20 ; Get an address movwf FSR ; Store that address movfw INDF ; Read data at location with that address
Register indirect addressing uses a register to store the address of the address of the data. MIPS Assembly uses lw R6,(R1). This means, take the contents of R1 as an address. Look in that address to find the data.
For the instruction shown, what value is
loaded into the accumulator for each addressing mode?
MIPS Code lw R6, 800 lw R7, Location lw R8, (R6) lw R9, 800(R6)
Location:
R6 = R7 = R8 = R9 =
For the instruction shown, what value is
loaded into the accumulator for each addressing mode?
MIPS Code lw R6, 800 lw R7, Location lw R8, (R6) lw R9, 800(R6)
Location:
R6 = 800 R7 = 900 R8 = 1000 R9 = 700