Docsity

Design Basics - High Performance Embedded Systems Design - Lecture Slides, Slides of Computer Science

Partial preview of the text

Download Design Basics - High Performance Embedded Systems Design - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

3-Software Design Basics in

Embedded Systems

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

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

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); }

Quartus II Development Tool

Example of File Menu

Creation of new project

Adding files to project

Electronic Design Automation Tools

Summary of project settings

Processing>Start Compilation

Assignment > Pins

For example, SW0,SW1 are connected on FPGA Pins

N25,N26. LEDG0 is pin AE22.

Programming the FPGA:

Tools>Programmer

  • Check the Program/Configure box, then click Start.
  • Wait till the progress bar show 100% (done).

Chapter Summary

  • General-purpose processors
    • Good performance, low NRE, flexible
  • Controller, data-path, and memory
  • Structured languages prevail
    • But some assembly level programming still necessary
  • Many tools available
    • Including instruction-set simulators, and in-circuit emulators
  • ASIPs
    • Microcontrollers, DSPs, network processors, more customized ASIPs
  • Choosing among processors is an important step
  • Designing a general-purpose processor is conceptually the same as designing a

single-purpose processor