Chapter 3 General-Purpose Processors: Software

Slides:



Advertisements
Similar presentations
1 ARM Movement Instructions u MOV Rd, ; updates N, Z, C Rd = u MVN Rd, ; Rd = 0xF..F EOR.
Advertisements

Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled.
UEE072HM Linking HLL and ALP An example on ARM. Embedded and Real-Time Systems We will mainly look at embedded systems –Systems which have the computer.
Slide 1CPU Emulator Tutorial This program is part of the software suite that accompanies the book The Digital Core, by Noam Nisan and Shimon Schocken 2003,
Slides created by: Professor Ian G. Harris PIC Development Environment MPLAB IDE integrates all of the tools that we will use 1.Project Manager -Groups.
Intel Computer Architecture Presented By Jessica Graziano.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
Embedded Systems Programming Introduction to cross development techniques.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Interrupt Processing Haibo Wang ECE Department
Chapter 3 General-Purpose Processors: Software
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 3 General-Purpose Processors: Software ECE 4330 Embedded System Design.
Table 1. Software Hierarchy Levels.. Essential Tools An assembler is a program that converts source-code programs into a machine language (object file).
1-1 Embedded Software Development Tools and Processes Hardware & Software Hardware – Host development system Software – Compilers, simulators etc. Target.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 3 General-Purpose Processors: Software.
General Purpose Processors: Software. This Week In DIG II  Introduction  Basic Architecture  Memory  Programmer’s view (that would be you !)  Development.
Practical Session No. 10 Input &Output (I/O). I/O Devices Input/output (I/O) devices provide the means to interact with the “outside world”. An I/O device.
General Purpose Processors: Software. This Week In DIG II  Introduction  Basic Architecture  Memory  Programmer’s view (that would be you !)  Development.
Parallel Ports of PC Methods of interfacing Examples.
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
Chapter 2 Software Tools and Assembly Language Syntax.
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
Micro-Computer Applications: Procedures & Interrupts Dr. Eng. Amr T. Abdel-Hamid ELECT 707 Fall 2011.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
1 3-Software Design Basics in Embedded Systems. 2 Development Environment Development processor  The processor on which we write and debug our programs.
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis 1 Basic Architecture Control unit and datapath –Note similarity.
Practical Session 11 Computer Architecture and Assembly Language Input &Output (I/O)
1 4-Development Environment Development processor  The processor on which we write and debug our programs Usually a PC Target processor  The processor.
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ read/write and clock inputs Sequence of control signal combinations.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Practical Session 11 Computer Architecture and Assembly Language Input &Output (I/O)
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Practical Session 3.
3-Software Design Basics in Embedded Systems
Seminar On 8085 microprocessor
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Basic Computer Organization and Design
Lab 1: Using NIOS II processor for code execution on FPGA
Lecture 2 Programming of 8086 Лектор: Люличева И.А. 1.
Format of Assembly language
Atmega32 Architectural Overview
Microprocessor and Assembly Language
Computing Systems Organization
ECE 353 Introduction to Microprocessor Systems
UNIT – Microcontroller.
Protection of System Resources
ACOE301: Computer Architecture II Labs
Microprocessor and Assembly Language
Chapter 3 General-Purpose Processors: Software
Interfacing Memory Interfacing.
CENG2400 Revision Q1a A system has an ARM processor with a 32-bit General Purpose Input Output (GPIO) module. Two on/off switches are connected to bit-3.
Code Generation.
פרטים נוספים בסילבוס של הקורס
Chapter 3 General-Purpose Processors: Software
Computer Architecture and Assembly Language
Chapter 3 General-Purpose Processors: Software
8051 ASSEMBLY LANGUAGE PROGRAMMING
Chapter 6 Programming the basic computer
8051 Development System Details
General Purpose Processor : Software
Computer Operation 6/22/2019.
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Presentation transcript:

Chapter 3 General-Purpose Processors: Software

Programmer View for Embedded Systems Instruction Set (for assembly language programming) Program and data memory space Embedded processors often offer limited space MIPS: Memória 4Gbytes x 8 (2**32 bits de endereçamento e cada endereço armazena 8 bits) Registers: How many for general purpose data storage? How many for special functions? MIPS: 32 registradores de 32 bits cada (veja a tabela do MIPS no livro texto) I/O: How to communicate with external signals? Parallel I/O: read/write port = read/write special regs Interrupts (interrupt service routine)

Example: parallel port driver LPT Connection Pin I/O Direction Register Address 1 Output 0th bit of register #2 2-9 0th-7th bit of register #0 14,16,17 1,2,3th bit of register #2 10,11,12,13,15 Input 6,7,5,4,3th bit of register #1 LPT connector: 12 output pins and 5 input pins Using assembly language programming we can configure a PC parallel port to perform digital I/O write and read to three special registers to accomplish this table provides list of parallel port connector pins and corresponding register location

Parallel Port Example: monitors the input switch and turns the LED on/off accordingly ; This program consists of a sub-routine that reads ; the state of the input pin, determining the on/off state ; of our switch and asserts the output pin, turning the LED ; on/off accordingly .386 CheckPort proc push ax ; save the content push dx ; save the content mov dx, 3BCh+1 ; base + 1 for register #1 in al, dx ; read register #1 and al, 10h ; mask out all but bit # 4 cmp al, 0 ; is it 0? jne SwitchOn ; if not, we need to turn the LED on SwitchOff: mov dx, 3BCh+0 ; base + 0 for register #0 in al, dx ; read the current state of the port and al, feh ; clear first bit (masking) out dx, al ; write it out to the port jmp Done ; we are done SwitchOn: or al, 01h ; set first bit (masking) Done: pop dx ; restore the content pop ax ; restore the content CheckPort endp extern “C” CheckPort(void); // defined in // assembly void main(void) { while( 1 ) { CheckPort(); } LPT Connection Pin I/O Direction Register Address 1 Output 0th bit of register #2 2-9 0th-7th bit of register #0 14,16,17 1,2,3th bit of register #2 10,11,12,13,15 Input 6,7,5,4,3th bit of register #1

Development Environment Development processor The processor on which we write and debug our programs Usually a PC Target processor The processor that the program will run on in our embedded system Often different from the development processor Development processor Target processor

Software Development Process Compilers Cross compiler Runs on one processor, but generates code for another Assemblers Linkers Debuggers Profilers Compiler Linker C File Asm. File Binary File Exec. File Assembler Library Implementation Phase Debugger Profiler Verification Phase

Running a Program If development processor is different than target, how can we run our compiled code? Two options: Download to target processor Simulate Simulation One method: Hardware description language But slow, not always available Another method: Instruction set simulator (ISS) Runs on development processor, but executes instructions of target processor

Testing and Debugging ISS Download to board Compromise: emulator Gives us control over time – set breakpoints, look at register values, set values, step-by-step execution, ... But, doesn’t interact with real environment Download to board Use device programmer Runs in real environment, but not controllable Compromise: emulator Runs in real environment, at speed or near Supports some controllability from the PC Implementation Phase Verification Phase Verification Phase Emulator Debugger/ ISS Programmer Development processor (a) (b) External tools

Instruction Set Simulator For A Simple Processor- Trivial Instruction Set Assembly instruct. First byte Second byte Operation MOV Rn, direct 0000 Rn direct Rn = M(direct) MOV direct, Rn 0001 Rn direct M(direct) = Rn MOV @Rn, Rm 0010 Rn Rm M(Rn) = Rm MOV Rn, #immed. 0011 Rn immediate Rn = immediate ADD Rn, Rm 0100 Rn Rm Rn = Rn + Rm SUB Rn, Rm 0101 Rn Rm Rn = Rn - Rm JZ Rn, relative 0110 Rn relative PC = PC+ relative (only if Rn is 0) opcode operands

Instruction Set Simulator For A Simple Processor #include <stdio.h> typedef struct { unsigned char first_byte, second_byte; } instruction; instruction program[1024]; //instruction memory unsigned char memory[256]; //data memory void run_program(int num_bytes) { int pc = -1; unsigned char reg[16], fb, sb; while( ++pc < (num_bytes / 2) ) { fb = program[pc].first_byte; sb = program[pc].second_byte; switch( fb >> 4 ) { case 0: reg[fb & 0x0f] = memory[sb]; break; case 1: memory[sb] = reg[fb & 0x0f]; break; case 2: memory[reg[fb & 0x0f]] = reg[sb >> 4]; break; case 3: reg[fb & 0x0f] = sb; break; case 4: reg[fb & 0x0f] += reg[sb >> 4]; break; case 5: reg[fb & 0x0f] -= reg[sb >> 4]; break; case 6: pc += sb; break; default: return –1; } return 0; int main(int argc, char *argv[]) { FILE* ifs; If( argc != 2 || (ifs = fopen(argv[1], “rb”) == NULL ) { return –1; if (run_program(fread(program, sizeof(program) == 0) { print_memory_contents(); return(0); else return(-1);