SlideShare a Scribd company logo
1 of 20
Download to read offline
WRITE ONCE ON SILICON AND PLAY IT FOR EVER
            : AN EMBEDDED JOURNEY


                     Sandip Ray
                     April 29, 2011
WHAT TO WRITE ?




                                                              2/7/2013
   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
HOW TO WRITE ?




                                                           2/7/2013
   Create a Flow Chart of what is inside your
    algorithm.

                           Start




                             Is
                           Temp                  End
                           > 90 C




                          Generate
                                                       3
                           Heat
IS YOUR CODE CORRECT ?




                                                          2/7/2013
 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.
                                                      4
THINK OF OPTIMIZATION




                                     2/7/2013
   Optimization in terms of :

 CPU Clocks
 Code Memory

 Data Memory

 Power etc.




                                 5
OPTIMIZATION IN TERMS OF CPU CLOCKS




                                                        2/7/2013
   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;

             }

       }
   }

                                                    6
OPTIMIZATION IN TERMS OF CPU CLOCKS




                                           2/7/2013
   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;

             }

       }
   }                                  7
OPTIMIZATION IN TERMS OF CODE




                                    2/7/2013
 *ptr++ = 10;
 *ptr++ = 20;

 *ptr++ = 30;

 *ptr++ = 40;



for(i=0;i<4;i++)
{
       *ptr++ = (10*i);
   }
                                8
OPTIMIZATION IN TERMS OF DATA




                                      2/7/2013
for(i=0;i<4;i++)
{
     B[i]=A[i]*3;
     for(j=0;j<10;j++)
     {
            C[i] [j]= B[i]*5+2;
        }
    }




                                  9
OPTIMIZATION IN TERMS OF DATA




                                    2/7/2013
for(i=0;i<4;i++)
{
     for(j=0;j<10;j++)
     {
            C[i][j] = A[i]*15+2;
        }
    }




                                   10
WHAT IS YOUR PLATFORM ?




                           2/7/2013
   X86

   ARM

   TI C55x

   TI C64x

   ADI Blackfin
                          11
WHAT ARE CODE GENERATION TOOLS ?




                                    2/7/2013
 Compiler
 Assembler

 Archiver

 Linker

 Debugger

 Simulator

 Profiler

 Hex Dump Utility



                                   12
COMPILER




                                                     2/7/2013
   Compiles the code from high level language to
    assembly language.

   Example : C, C++, Fortran, Java




                                                    13
ASSEMBLER




                                                     2/7/2013
   Assembles the assembly code to binary opcodes
    and operands.

 MOV #40, A
 SUB A, B, A

 LD *A++, C




                                                    14
LINKER




                                                        2/7/2013
   Links the code as per the provided code and data
    memory map.



   Example : TI C64x Linker, gcc




                                                       15
DEBUGGER




                                                   2/7/2013
   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.   16
SIMULATOR




                                             2/7/2013
 Functional Simulator
 Instruction Set Simulator

 Cycle Accurate Simulator




   Example : TI Code Composer Studio IDE




                                            17
IS YOUR CODE RUNNING FINE ON SIMULATOR
?




                                                         2/7/2013
   Debug till the point your expected output doesn’t
    appear on the screen.



   Ahhhhh…… Finally it is coming !!!




                                                        18
WANT TO TRY IT OUT ON SILICON ?




                                                            2/7/2013
 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.                              19
2/7/2013
THANK YOU




            20

More Related Content

Similar to Write once on silicon

No liftoff, touchdown, or heartbeat shall miss because of a software failure
No liftoff, touchdown, or heartbeat shall miss because of a software failureNo liftoff, touchdown, or heartbeat shall miss because of a software failure
No liftoff, touchdown, or heartbeat shall miss because of a software failureRogue Wave Software
 
Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Dr. Pankaj Zope
 
180 daraga cpp course session-1
180 daraga cpp course session-1180 daraga cpp course session-1
180 daraga cpp course session-1Moustafa Ghoniem
 
Mathematically Guaranteed C and C++ Code
Mathematically Guaranteed C and C++ CodeMathematically Guaranteed C and C++ Code
Mathematically Guaranteed C and C++ CodePauline Schellenberger
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll buildMark Stoodley
 
Full-stack Web Development with MongoDB, Node.js and AWS
Full-stack Web Development with MongoDB, Node.js and AWSFull-stack Web Development with MongoDB, Node.js and AWS
Full-stack Web Development with MongoDB, Node.js and AWSMongoDB
 
Denis Nagorny - Pumping Python Performance
Denis Nagorny - Pumping Python PerformanceDenis Nagorny - Pumping Python Performance
Denis Nagorny - Pumping Python PerformanceSergey Arkhipov
 
Driving Assistant Solutions with Android
Driving Assistant Solutions with AndroidDriving Assistant Solutions with Android
Driving Assistant Solutions with AndroidGiorgio Natili
 
Christophe Jolif - Flex Data Visualization going one step further with IBM IL...
Christophe Jolif - Flex Data Visualization going one step further with IBM IL...Christophe Jolif - Flex Data Visualization going one step further with IBM IL...
Christophe Jolif - Flex Data Visualization going one step further with IBM IL...360|Conferences
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Windows Developer
 
程序员实践之路
程序员实践之路程序员实践之路
程序员实践之路Horky Chen
 
FGS 2011: Flash+ A Whole New Dimension for Games
FGS 2011: Flash+ A Whole New Dimension for GamesFGS 2011: Flash+ A Whole New Dimension for Games
FGS 2011: Flash+ A Whole New Dimension for Gamesmochimedia
 
Open Source Robotics as Booster to Creativity
Open Source Robotics as  Booster to CreativityOpen Source Robotics as  Booster to Creativity
Open Source Robotics as Booster to CreativityCarlos J. Costa
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the ArduinoCharles A B Jr
 
XT Best Practices
XT Best PracticesXT Best Practices
XT Best PracticesJeff Larkin
 
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, NepalArduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepalbishal bhattarai
 

Similar to Write once on silicon (20)

No liftoff, touchdown, or heartbeat shall miss because of a software failure
No liftoff, touchdown, or heartbeat shall miss because of a software failureNo liftoff, touchdown, or heartbeat shall miss because of a software failure
No liftoff, touchdown, or heartbeat shall miss because of a software failure
 
Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming
 
180 daraga cpp course session-1
180 daraga cpp course session-1180 daraga cpp course session-1
180 daraga cpp course session-1
 
Mathematically Guaranteed C and C++ Code
Mathematically Guaranteed C and C++ CodeMathematically Guaranteed C and C++ Code
Mathematically Guaranteed C and C++ Code
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
Full-stack Web Development with MongoDB, Node.js and AWS
Full-stack Web Development with MongoDB, Node.js and AWSFull-stack Web Development with MongoDB, Node.js and AWS
Full-stack Web Development with MongoDB, Node.js and AWS
 
Denis Nagorny - Pumping Python Performance
Denis Nagorny - Pumping Python PerformanceDenis Nagorny - Pumping Python Performance
Denis Nagorny - Pumping Python Performance
 
Driving Assistant Solutions with Android
Driving Assistant Solutions with AndroidDriving Assistant Solutions with Android
Driving Assistant Solutions with Android
 
Resume
ResumeResume
Resume
 
Christophe Jolif - Flex Data Visualization going one step further with IBM IL...
Christophe Jolif - Flex Data Visualization going one step further with IBM IL...Christophe Jolif - Flex Data Visualization going one step further with IBM IL...
Christophe Jolif - Flex Data Visualization going one step further with IBM IL...
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
 
程序员实践之路
程序员实践之路程序员实践之路
程序员实践之路
 
FGS 2011: Flash+ A Whole New Dimension for Games
FGS 2011: Flash+ A Whole New Dimension for GamesFGS 2011: Flash+ A Whole New Dimension for Games
FGS 2011: Flash+ A Whole New Dimension for Games
 
Open Source Robotics as Booster to Creativity
Open Source Robotics as  Booster to CreativityOpen Source Robotics as  Booster to Creativity
Open Source Robotics as Booster to Creativity
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the Arduino
 
virendra
virendravirendra
virendra
 
XT Best Practices
XT Best PracticesXT Best Practices
XT Best Practices
 
DishitJoshi_CV
DishitJoshi_CVDishitJoshi_CV
DishitJoshi_CV
 
Introduction to 2D/3D Graphics
Introduction to 2D/3D GraphicsIntroduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
 
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, NepalArduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
 

Write once on silicon

  • 1. WRITE ONCE ON SILICON AND PLAY IT FOR EVER : AN EMBEDDED JOURNEY Sandip Ray April 29, 2011
  • 2. WHAT TO WRITE ? 2/7/2013  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
  • 3. HOW TO WRITE ? 2/7/2013  Create a Flow Chart of what is inside your algorithm. Start Is Temp End > 90 C Generate 3 Heat
  • 4. IS YOUR CODE CORRECT ? 2/7/2013  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. 4
  • 5. THINK OF OPTIMIZATION 2/7/2013  Optimization in terms of :  CPU Clocks  Code Memory  Data Memory  Power etc. 5
  • 6. OPTIMIZATION IN TERMS OF CPU CLOCKS 2/7/2013  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;  }  }  } 6
  • 7. OPTIMIZATION IN TERMS OF CPU CLOCKS 2/7/2013  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;  }  }  } 7
  • 8. OPTIMIZATION IN TERMS OF CODE 2/7/2013  *ptr++ = 10;  *ptr++ = 20;  *ptr++ = 30;  *ptr++ = 40; for(i=0;i<4;i++) {  *ptr++ = (10*i);  } 8
  • 9. OPTIMIZATION IN TERMS OF DATA 2/7/2013 for(i=0;i<4;i++) {  B[i]=A[i]*3;  for(j=0;j<10;j++)  { C[i] [j]= B[i]*5+2; } } 9
  • 10. OPTIMIZATION IN TERMS OF DATA 2/7/2013 for(i=0;i<4;i++) {  for(j=0;j<10;j++)  { C[i][j] = A[i]*15+2; } } 10
  • 11. WHAT IS YOUR PLATFORM ? 2/7/2013  X86  ARM  TI C55x  TI C64x  ADI Blackfin 11
  • 12. WHAT ARE CODE GENERATION TOOLS ? 2/7/2013  Compiler  Assembler  Archiver  Linker  Debugger  Simulator  Profiler  Hex Dump Utility 12
  • 13. COMPILER 2/7/2013  Compiles the code from high level language to assembly language.  Example : C, C++, Fortran, Java 13
  • 14. ASSEMBLER 2/7/2013  Assembles the assembly code to binary opcodes and operands.  MOV #40, A  SUB A, B, A  LD *A++, C 14
  • 15. LINKER 2/7/2013  Links the code as per the provided code and data memory map.  Example : TI C64x Linker, gcc 15
  • 16. DEBUGGER 2/7/2013  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. 16
  • 17. SIMULATOR 2/7/2013  Functional Simulator  Instruction Set Simulator  Cycle Accurate Simulator  Example : TI Code Composer Studio IDE 17
  • 18. IS YOUR CODE RUNNING FINE ON SIMULATOR ? 2/7/2013  Debug till the point your expected output doesn’t appear on the screen.  Ahhhhh…… Finally it is coming !!! 18
  • 19. WANT TO TRY IT OUT ON SILICON ? 2/7/2013  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. 19