Programming in SMALL, Lecture Slides - Computer Science, Slides of Computers and Information technologies

XMOS Software Developement Tools Softwares Application Hardwares Bloatware Memory per user component Data Flow copying

Typology: Slides

2010/2011

Uploaded on 09/06/2011

stifler_11
stifler_11 🇬🇧

4.6

(9)

272 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programming
in the small
Henk Muller
Principal Technologist, XMOS
;026EUDQGLQJVW\OHJXLGH
FRUSRUDWHEUDQGHOHPHQWV
SULPDU\ORJRW\SHYHUVLRQV
)RU FRO RXU UH SURG XFWL RQ WKH ORJRW \SH VKRXO G EH FU HDWHG XVLQ J WKH
FRUSRUDWHFROR XUSDOHWWH7KH;VKRXOGDOZD\VEHSDQWRQHRU
WKHFORVHVWHTXLYDOHQW5*%RU&0<.YDOXHV:KHQSRVLWLRQHGDJDLQVW
SXUHZK LWH02 6VKRXO GEH FRORXUH GDV D WLQW RIEODF N,Q RUGHU
WRUHW DLQ WKH VDPH SHUF HSWXDO WRQH YDOXHV DFU RVV WKH GHVLJQ ZK HQ
SRVLWLRQHGDJ DLQVWSXUHEO DFN026VK RXOGEHFR ORXUHGDVD WLQW
RIEODFN)RUPRQRWRQ HGHVLJQVWKHGHVL JQVKRXOGEHFUHDW HGHLWKHULQ
SXUHEODFN RU ZKLWHRQO \7KHO RJRW\SH VKRXOG1 27EH FUHDWHGX VLQJ
DQRWKHURWKHUVFKHP HFRQWDLQVH[DPSOHVRILQFRUUHF WXVDJH
:KHQS RVLWLRHG DJDLQV WDQ\ RWKHU FRORXU RU ZKHUH WKH GHVLJV
FOHDU VSDFH LV LQ WHUXS WHG E\ RW KHU GH VLJQ H OHPHQ WV WKH
VHFRQGDU \ORJRW\SHWK H;026ODEHOVK RXOGEHDGRSW HG
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Programming in SMALL, Lecture Slides - Computer Science and more Slides Computers and Information technologies in PDF only on Docsity!

Programming

in the small

Henk Muller

Principal Technologist, XMOS

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

XMOS

  • A company that designs and sells microprocessors.
    • We design a processor (using Verilog - You may have used that for Computer Architecture)
    • We ship the design to a manufacturing plant
    • We get the chips back
    • We sell the chips.

Challenge:

  • Make a good processor (“better” than everybody else’s)
  • Make a good software development platform (“better” again)
  • Make good application software.

We do not sell software, but half the company staff are designing software of one sort or another...

Henk MullerASD lecture, November 24, 2010 (^2)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

Tools for internal use

We need a tool chain to build the processor and the tools

  • Precise simulator
    • Emulate the processor in software.
  • Build systems
    • Automatically build
  • Regression systems
    • Build, run and compare everything against expected output.
  • Verification systems
    • Mechanically compare two implementations against each other
  • Hardware timing and power analysis tools
    • Tools that tell us how the chip will perform.

Henk MullerASD lecture, November 24, 2010 (^4)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

Tools for customers

The processor needs a tool chain for software development

  • Compilers
  • Linker
  • Debugger
  • Timing analyser
  • IDE

Additional tools required for

  • Downloading code
  • Burning code onto the device
  • Making encrypted loaders.

Henk MullerASD lecture, November 24, 2010 (^5)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

Languages - Tools

We use XC, C, C++, Java, Perl, Python, XC, Assembly code, (and Verilog)

C, C++, Java are used to build all customer facing tools

  • For example, LLVM (the C compiler that we use) is largely written in C++

Perl and Python are used internally for scripting

  • Munching data files
  • Overnight build
  • Overnight regression
  • etc.

Henk MullerASD lecture, November 24, 2010 (^7)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

Languages - Applications

XC is used to implement most programs that run on our Hardware

  • C with real time and concurrency built in

Assembly code

  • Used whenever we cannot get there.
  • When problems are challenging the limits of our hardware, and we need to get the extra 20%

Compilers need many man years of investment before they can generate mature code

  • The XC compiler is good, but hand written code can still beat it.

Henk MullerASD lecture, November 24, 2010 (^8)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

XMOS software How does one program a device like this?

  • Processor speed is ok (order of magnitude slower than a Pentium)
  • Processor I/O and real time behaviour is superior to competition.
  • But processor memory is limited to 64 K (single chip)

Current software memory requirements:

  • Firefox requires 230 MBytes of memory; 4000 times XCore
  • Current compilers requires 10-100 MBytes of memory.
  • Linux needs tens of megabytes just to do nothing (better than Windows that requires a GByte to do nothing). Compare with
  • Old fashioned Unix (ran in 32 KBytes)
  • ZX-80 micro (1KByte ram)
  • BBC micro (16 KByte ram)

Henk MullerASD lecture, November 24, 2010 (^10)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

Bloat ware

Current systems are build to bloat:

  • In order to shorten development times
    • Borrow libraries of which you only use a fraction of the code
    • Rather than represent a set as a bit vector, use a ’HashSet()’
  • These are good abstractions if you have the oomph.
  • They are bad abstractions if you aim for low-power.

Lets elaborate on the HashSet - and show efficiency, limitations, and sharing.

Henk MullerASD lecture, November 24, 2010 (^11)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

Memory use per component

Design each component to manage its own memory

  • Component needs a predictable and precise amount of memory
  • Don’t add 1 just for the sake of it

Now make sure that all components fit together statically

  • Do not guess that it may fit
  • Do not rely on malloc
    • Memory may run out dynamically (when the aeroplane lands)
    • Malloc needs memory to register memory
    • Malloc needs program code too. Everybody loses.

Henk MullerASD lecture, November 24, 2010 (^13)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

Data flow: pass data around

When component 1 is done with the data, pass it on to component 2.

  • Do not just store it in a buffer where component 2 can pick it up later.

Buffers have a place in data flow management:

  • Buffers can smooth data flow.
  • Buffers do not increase bandwidth
  • Buffers increase latency
  • Buffers take a lot of memory
  • Buffers make it difficult to analyse code

Henk MullerASD lecture, November 24, 2010 (^14)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU

Conclusions

Memory is a scarce resource

  • Think as hard about using memory.

Could give the same talk about power-aware software:

  • Power is a scarce resource, think twice about doing unnecessary operations

Interestingly: Low memory designs are usually more efficient

  • It takes a lot of power and time to fill memory...

Designing software is hard.

Henk MullerASD lecture, November 24, 2010 (^16)

FRUSRUDWHEUDQGHOHPHQWV  SULPDU\ORJRW\SHYHUVLRQV )RU FRORXU UHSURGXFWLRQ WKH ORJRW\SH VKRXOG EH FUHDWHG XVLQJ WKHFRUSRUDWHFRORXUSDOHWWH  7KH;VKRXOGDOZD\VEHSDQWRQH RU