Write once on silicon
-
Upload
sandip-ray -
Category
Documents
-
view
153 -
download
0
Transcript of Write once on silicon
WRITE ONCE ON SILICON AND PLAY IT FOR EVER : AN EMBEDDED JOURNEY
Sandip Ray
April 29, 2011
WHAT TO WRITE ?
Any thing that comes to your mind.
Any language you can choose.
Write a small C code of your favorite game.
Or your favorite algorithm that you have learned in
your computer science class.
2/7
/20
13
2
HOW TO WRITE ?
Create a Flow Chart of what is inside your
algorithm.
Start
Is
Temp
> 90 C
Generate
Heat
End
2/7
/20
13
3
IS YOUR CODE CORRECT ?
Review 2 times before a bug catches your eye.
Share the code with your peer to review it once
again.
Compile the code.
0 Warnings, 0 Errors !!!!
Too good, you have written an excellent code.
If errors are there, you have to go through your
code and try to fix it.
If warnings are there, you have to understand the
source of it and try to avoid it.
2/7
/20
13
4
THINK OF OPTIMIZATION
Optimization in terms of :
CPU Clocks
Code Memory
Data Memory
Power etc.
2/7
/20
13
5
OPTIMIZATION IN TERMS OF CPU CLOCKS
for (i=0;i<100;i++)
{
for(j=0;j<50;j++)
{
for(k=0;k<25;k++)
{
A[i][j][k]= B[i][j]*8 + C[i]*4;
}
}
}
2/7
/20
13
6
OPTIMIZATION IN TERMS OF CPU CLOCKS
for (i=0;i<100;i++)
{
M= C[i]<<2;
for(j=0;j<50;j++)
{
N= B[i][j]<<3;
for(k=0;k<25;k++)
{
A[i][j][k]= M + N;
}
}
}
2/7
/20
13
7
OPTIMIZATION IN TERMS OF CODE
*ptr++ = 10;
*ptr++ = 20;
*ptr++ = 30;
*ptr++ = 40;
for(i=0;i<4;i++)
{
*ptr++ = (10*i);
}
2/7
/20
13
8
OPTIMIZATION IN TERMS OF DATA
for(i=0;i<4;i++)
{
B[i]=A[i]*3;
for(j=0;j<10;j++)
{
C[i] [j]= B[i]*5+2;
}
}
2/7
/20
13
9
OPTIMIZATION IN TERMS OF DATA
for(i=0;i<4;i++)
{
for(j=0;j<10;j++)
{
C[i][j] = A[i]*15+2;
}
}
2/7
/20
13
10
WHAT IS YOUR PLATFORM ?
X86
ARM
TI C55x
TI C64x
ADI Blackfin
2/7
/20
13
11
WHAT ARE CODE GENERATION TOOLS ?
Compiler
Assembler
Archiver
Linker
Debugger
Simulator
Profiler
Hex Dump Utility
2/7
/20
13
12
COMPILER
Compiles the code from high level language to
assembly language.
Example : C, C++, Fortran, Java
2/7
/20
13
13
ASSEMBLER
Assembles the assembly code to binary opcodes
and operands.
MOV #40, A
SUB A, B, A
LD *A++, C
2/7
/20
13
14
LINKER
Links the code as per the provided code and data
memory map.
Example : TI C64x Linker, gcc
2/7
/20
13
15
DEBUGGER
To find the bug or fault in the code.
Run
Single Step
Run Till This Point
Step Over
Step Through
Breakpoint
Log
Example : TI Code Composer Studio IDE, gdb.
2/7
/20
13
16
SIMULATOR
Functional Simulator
Instruction Set Simulator
Cycle Accurate Simulator
Example : TI Code Composer Studio IDE
2/7
/20
13
17
IS YOUR CODE RUNNING FINE ON SIMULATOR
?
Debug till the point your expected output doesn’t
appear on the screen.
Ahhhhh…… Finally it is coming !!!
2/7
/20
13
18
WANT TO TRY IT OUT ON SILICON ?
Yes !!! You can run the code on silicon(provided it is not a mission critical one)
Connect the hardware board with serial port, parallel port or PCI through JTAG.
Load the object file on processor.
Press Run and see if expected output are coming on the screen.
If yes, you are done !!!
And don’t forget to check the performance of your code by using a profiler.
2/7
/20
13
19
THANK YOU
2/7
/20
13
20