Shop OBEX P1 Docs P2 Docs Learn Events
How many instructions? — Parallax Forums

How many instructions?

HumanoidoHumanoido Posts: 5,770
edited 2010-02-15 17:19 in Propeller 1
The EEPROM (Program) Size for the BASIC Stamp BS2px is:
8 x 2 KBytes; which holds ~4,000 PBASIC instructions according
to Parallax specs. How many instructions can the stock Propeller
chip hold in internal RAM? (for SPIN and for Assembly)

Comments

  • AleAle Posts: 2,363
    edited 2010-02-15 10:38
    8192 ASM
    Between 32768 (1 byte) and 6553 (5 bytes load 32 bit constant)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit some of my articles at Propeller Wiki:
    MATH on the propeller propeller.wikispaces.com/MATH
    pPropQL: propeller.wikispaces.com/pPropQL
    pPropQL020: propeller.wikispaces.com/pPropQL020
    OMU for the pPropQL/020 propeller.wikispaces.com/OMU
    pPropellerSim - A propeller simulator for ASM development sourceforge.net/projects/ppropellersim
  • BradCBradC Posts: 2,601
    edited 2010-02-15 10:40
    humanoido said...
    The EEPROM (Program) Size for the BASIC Stamp BS2px is:
    8 x 2 KBytes; which holds ~4,000 PBASIC instructions according
    to Parallax specs. How many instructions can the stock Propeller
    chip hold in internal RAM? (for SPIN and for Assembly)

    ~8176 for Assembly.
    Spin depends on what constitutes an instruction I guess. ~20,000 for Spin based on an average "instruction" of about 2.5 bytes.
    The answers actually pose more questions really as you run into issues of object headers, the binary header, stack space and variable space..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You only ever need two tools in life. If it moves and it shouldn't use Duct Tape. If it does not move and it should use WD40.
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-02-15 11:43
    Ale & BradC:

    Thanks for your calculations!
    I will use this as the basis of a new Propeller project.

    humanoido
  • MagIO2MagIO2 Posts: 2,243
    edited 2010-02-15 12:36
    If we count how many instructions can be in fast access you can't use the same metrics as on the BS2. BS2 only has one memory, but the Propeller has 2 kinds of memories: the COG memory and the HUB memory.
    With a little boot-loader you can load PASM code into the COGs and then reuse the whole HUB-RAM for additional SPIN/PASM-code. Most times drivers are in PASM. Let's say you have 5 COGs pre-loaded running in PASM : 5x512 = 2560

    And on top of that you'd have the ~20,000 SPIN-instructions xor ~8,000 addidional PASM instructions.
  • heaterheater Posts: 3,370
    edited 2010-02-15 13:37
    Soon you can program your prop using Zog and the GCC Compiler for C or C++. Zog only has one byte opcodes. The Zog virtual machine fits in 1 COG and needs a 128 byte dispatch table in HUB.

    So 32768 - 128 = 32640 instructions in HUB.

    Let's call it 32000 to allow for any other house keeping.

    Then 7 * 496 = 3472 PASM instructions purring away in parallel.

    Now I'm not being totally serious here as Zog probably needs more instruction bytes to do the same work as Spin and is probably going to be slower.

    BUT this is my chance, Humanoido, to remind you that soon you have to add C++ to the ever growing list of languages the Prop can be programmed in[noparse]:)[/noparse]

    Perhaps also another entry for C compiled with GCC for Zog as the GCC dialect can have some differences to standard C.

    GCC also supports some other languages: Objective-C, Java, Fortran, and Ada. Although I'm not sure if I will ever be able to get those working with Zog on the Propeller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-02-15 14:15
    MagIO2 said...
    If we count how many instructions can be in fast access you can't use the same metrics
    as on the BS2. BS2 only has one memory, but the Propeller has 2 kinds of memories:
    the COG memory and the HUB memory. With a little boot-loader you can load PASM
    code into the COGs and then reuse the whole HUB-RAM for additional SPIN/PASM-code.
    Most times drivers are in PASM. Let's say you have 5 COGs pre-loaded running in PASM :
    5x512 = 2560. And on top of that you'd have the ~20,000 SPIN-instructions xor ~8,000
    addidional PASM instructions.
    MagIO2, this is a fantastic technique and a great find from your study of the Prop, for
    squeezing out more code capability! As you know, any technique to gain even one more
    code statement out of the prop chip is going to significantly make a big difference in this
    project. Thank you for being part of it by helping!

    humanoido
  • MagIO2MagIO2 Posts: 2,243
    edited 2010-02-15 15:20
    Besides my other little working-areas, there is this one having some kind of code-library which supports driver loading. Having PASM drivers in upper part of EEPROM (above 32k), where each driver has a little descriptor containing name and version number and size of parameter-area. (Storing dirvers in EEPROM is what currently exists)

    One way to use that would be a OS which reads a .INI-file where all needed drivers are listed for a program. So the OS can prepare everything before loading the main-program. In the main program only a little library is needed which finds out where the parameter areas of the different drivers are.

    Another way is a standalone library for programs where the lib takes care of loading the drivers by name. This needs a little more HUB-RAM, as a load-buffer is needed and the lib is propably a bit bigger. But it's more interesting for standalone-systems than having a OS.

    The other advantage could be that the community could write programs where nobody hase to take care of driver-setup ... is the pin used for SD card correctly set? .. is the keyboard attached to the same pin as in my setup? ... Each propeller setup has a set of drivers in upper EEPROM which works. So, each program that uses these drivers will work - even if the setup of developers propeller system was completely different.
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-02-15 17:19
    heater said...
    Soon you can program your prop using Zog and the GCC Compiler for C or C++. Zog only has one byte opcodes. The Zog virtual machine fits in 1 COG and needs a 128 byte dispatch table in HUB. So 32768 - 128 = 32640 instructions in HUB. Let's call it 32000 to allow for any other house keeping. Then 7 * 496 = 3472 PASM instructions purring away in parallel. Now I'm not being totally serious here as Zog probably needs more instruction bytes to do the same work as Spin and is probably going to be slower. BUT this is my chance, Humanoido, to remind you that soon you have to add C++ to the ever growing list of languages the Prop can be programmed in[noparse]:)[/noparse] Perhaps also another entry for C compiled with GCC for Zog as the GCC dialect can have some differences to standard C. GCC also supports some other languages: Objective-C, Java, Fortran, and Ada. Although I'm not sure if I will ever be able to get those working with Zog on the Propeller.
    heater: we are definitely waiting for this revelation!!!

    humanoido
Sign In or Register to comment.