Propeller II update - BLOG

17172747677223

Comments

  • Heater.Heater. Posts: 21,213
    edited 2013-08-26 - 22:51:06
    Well yes, Andy, that is the normal way of getting a COG started with a method from another object. But it is not done directly by COGNEW(). But why not?

    Looking at it now we see that COGNEW and friends are very weird from a language perspective.

    1) They are free standing global functions. That is odd because otherwise Spin has no such concept, all "functions" belong to objects as methods. How come I cannot write such a function for myself?

    2) They are polymorphic. I can use COGNEW to start a Spin method in a COG or some PASM code. That tells me that there are really two COGNEW functions under the hood and the one used depends on the type of the parameters I give it. That is odd because Spin otherwise has no concept of polymorphic methods. How come I cannot write such methods myself?

    3) They are examples of treating functions as data. The first parameter to COGNEW can be method name. That's very weird because otherwise Spin does dot support using methods as data, for example a value of a parameter in a call. How come I cannot write methods that take other methods as parameters myself?

    Let's go further. From a purely language perspective I see no reason why I should not be able to write "COGNEW(someObject.someMethod, ....)
    There seems to be no reason why this is not allowed apart from difficulty in the compiler/interpreter.

    Looked at this way we see that COGNEW and friends are really special case freaks in the language that don't fit the overall structure of Spin. Perhaps cleaning up this kludge into the Spin syntax is not such a bad idea.
  • David BetzDavid Betz Posts: 13,530
    edited 2013-08-27 - 04:36:17
    Heater. wrote: »
    Well yes, Andy, that is the normal way of getting a COG started with a method from another object. But it is not done directly by COGNEW(). But why not?

    Looking at it now we see that COGNEW and friends are very weird from a language perspective.

    1) They are free standing global functions. That is odd because otherwise Spin has no such concept, all "functions" belong to objects as methods. How come I cannot write such a function for myself?

    2) They are polymorphic. I can use COGNEW to start a Spin method in a COG or some PASM code. That tells me that there are really two COGNEW functions under the hood and the one used depends on the type of the parameters I give it. That is odd because Spin otherwise has no concept of polymorphic methods. How come I cannot write such methods myself?

    3) They are examples of treating functions as data. The first parameter to COGNEW can be method name. That's very weird because otherwise Spin does dot support using methods as data, for example a value of a parameter in a call. How come I cannot write methods that take other methods as parameters myself?

    Let's go further. From a purely language perspective I see no reason why I should not be able to write "COGNEW(someObject.someMethod, ....)
    There seems to be no reason why this is not allowed apart from difficulty in the compiler/interpreter.

    Looked at this way we see that COGNEW and friends are really special case freaks in the language that don't fit the overall structure of Spin. Perhaps cleaning up this kludge into the Spin syntax is not such a bad idea.
    Very good points. I agree with every one of them. One of the basic principles of language design is to avoid lots of special cases. One should be able to pass a value of any type to a function, return it from a function, or assign it to a variable. C is certainly not perfect in this regard either since the syntax for passing arguments "by reference" is different for different types (arrays are passed by reference by default as are functions but structures require an &). I guess there is no perfect language.
  • Dave HeinDave Hein Posts: 5,956
    edited 2013-08-27 - 05:30:41
    I think the reason that a new cog cannot be started with a method in another object is that there was no room in the interpreter to support this. There's no technical reason that prevents starting a Spin cog with a method from another object. The extra code needed to start a cog with a method in another object should be similar to that needed to call a method in another object. There's just no room in the interpreter for it.
  • rjo__rjo__ Posts: 2,027
    edited 2013-08-27 - 06:20:24
    Heater,

    Knowing that something is possible and actually being able to do it are two different things:)
    My thinking was that we can store anything on an sd-card... so machine executable code could be stored there.... you read it into an array, tell your cog where that array is...
    the cog loads the instructions via self-modifying code techniques and you are done. If you want to tell the cog where to start executing the code. If your program wants other parameters, they are stored in the array at specific places with specific meaning, which your cog program respects.
    :)
  • GadgetmanGadgetman Posts: 2,436
    edited 2013-08-27 - 08:45:00
    Heater. wrote: »
    So, I assert that a function returning an error is often the same as an operation that just aborts your entire program. Whatever it is has failed. What can you do? That's OK at test and debug time. When running in the field your system is dead whatever.

    No.
    This is what 'boundary checks' and 'exception handling' is all about.

    If the system has a screen, it can output some debug information, which the user can write down and relay to you, preferably with a detailed description of what they were doing.
    If it doesn't have a screen, maybe it has some sort of storage(I2C, SPI, 1-Wire, whatever) that it can dump a log into?

    then it should either retry the operation(such as asking the user for the correct input, attempt another read from a device or whatever), 'die gracefully' or possibly restart.
    (Die gracefully = stop all external equipment in a safe manner, then halt the CPU. Quite important if it controls heavy machinery or sharp bits... )
  • Heater.Heater. Posts: 21,213
    edited 2013-08-27 - 11:14:11
    Gadgetman,

    What do you mean "No". Perhaps "maybe".

    If my program tries to perform some operation that fails there seem to be a couple of options:

    1) The operation returns an error code which my program checks and handles somehow. Basically the error has diverted the flow of control in my code. If I don't check the error something weird and probably bad happens.

    2) The operation throws some kind of exception which my program catches and handles somehow. Basically the error has diverted the flow of control in my code. If I don't catch the exception something weird and probably bad happens. If I don't catch any exceptions then the program probably terminates which may not be such a good thing.

    Basically error returns or exceptions are the same thing. Although we can argue about which is the easiest to think about when constructing the code.

    Having a user around to decide how to continue makes no difference. In embedded systems that is not an option anyway.

    The classic examples are claiming memory, "malloc" in C vs "new" in C++. It could well be that my program is going to fail for lack of memory. It's going to fail. Using exceptions or return codes does not change that fact.

    At the end of the day an exception is just a higher level and less efficient way of writing "goto". That is why the Linux kernel is full of gotos.

    The issue of "boundary checks" is something else. For example:
    In Ada, for example, accessing an array out of bounds "array[x]" can create an exception. Or a simple operation like "x = x + 1" can raise an exception. Sure you cannot do that in C or Spin.

    The big gain here is that such exceptions are detected by the run time system or OS rather than silently happening and causing weird stuff to happen later on in execution. You really don't want to be checking an error code every time yo access an array or do an arithmetic operation.

    That is to say "I can't do that" is better than "I did it, it might be wrong".

    There are those that would argue that if these things are happening in your production code you have not performed enough testing and/or coverage analysis. That quad copter you are controlling is going to crash the same with error code checking or exceptions.
  • David BetzDavid Betz Posts: 13,530
    edited 2013-08-27 - 11:33:41
    Ummm, I know I'm one of the offenders but could we move language wars to another topic? I keep thinking there is some exciting update on P2 but only find various interesting but irrelevant to the topic comments on language design. :-)
  • Heater.Heater. Posts: 21,213
    edited 2013-08-27 - 11:39:04
    OK David, we are just twiddling our thumbs whist waiting.

    Is it ready yet?
  • DaveJensonDaveJenson Posts: 261
    edited 2013-08-27 - 11:48:23
    Heater. wrote: »
    OK David, we are just twiddling our thumbs whist waiting.

    Is it ready yet?

    How about now?
  • David BetzDavid Betz Posts: 13,530
    edited 2013-08-27 - 12:56:28
    Heater. wrote: »
    OK David, we are just twiddling our thumbs whist waiting.

    Is it ready yet?
    Well, some of us don't *have* to be in thumb twiddling mode since we have FPGA boards we could be working with. I have to admit though that I haven't plugged mine in in weeks. I need to get back to it!
  • Heater.Heater. Posts: 21,213
    edited 2013-08-27 - 13:36:04
    Good reminder, there are P II things to be done even without an actual PII.
    I have one cogs worth of FPGA to be getting on with.
  • cgraceycgracey Posts: 11,734
    edited 2013-08-27 - 16:08:23
    UPDATE: someone said they were hoping for an update. The wafers are getting packaged in Taiwan. Hopefully we'll see some chips next week. I'm still working on the compiler. It's coming together nicely. I think all the flow-control (IF/CASE/REPEAT) is done. The variable handling is pretty much done, but needs to grow a little to accommodate some new stack/local type. All the compilers bones are getting adjusted and fine-tuned, and 95% of the flesh is on. I'm really looking forward to being able to use it write programs for Prop2.
  • ozpropdevozpropdev Posts: 2,577
    edited 2013-08-27 - 16:26:27
    Excellent news Chip!
    Heart rate is up right now!!
    Melbourne, Australia
  • potatoheadpotatohead Posts: 9,801
    edited 2013-08-27 - 16:27:18
    AWESOME!!

    I'm going to explore the Invaders code on mine tonight. I've had it off for a few weeks myself. Real life got in the way, and that mystery "why does the TV driver tear?" bug is still out there to get fixed...

    @Chip: So am I.
    Do not taunt Happy Fun Ball! @opengeekorg ---> Be Excellent To One Another SKYPE = acuity_doug
    Parallax colors simplified: https://forums.parallax.com/discussion/123709/commented-graphics-demo-spin<br>
  • SapiehaSapieha Posts: 2,964
    edited 2013-08-27 - 16:42:41
    Hi Chip.

    Nice progress
    cgracey wrote: »
    UPDATE: someone said they were hoping for an update. The wafers are getting packaged in Taiwan. Hopefully we'll see some chips next week. I'm still working on the compiler. It's coming together nicely. I think all the flow-control (IF/CASE/REPEAT) is done. The variable handling is pretty much done, but needs to grow a little to accommodate some new stack/local type. All the compilers bones are getting adjusted and fine-tuned, and 95% of the flesh is on. I'm really looking forward to being able to use it write programs for Prop2.
    Regards
    Sapieha
    _____________________________________________________
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it as simple as possible yet as versatile/usable as possible.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,090
    edited 2013-08-27 - 17:19:34
    Most Excellent! Thanks Chip!
    <br>
  • Bill HenningBill Henning Posts: 6,445
    edited 2013-08-27 - 18:52:14
    Sounds good!
    cgracey wrote: »
    UPDATE: someone said they were hoping for an update. The wafers are getting packaged in Taiwan. Hopefully we'll see some chips next week. I'm still working on the compiler. It's coming together nicely. I think all the flow-control (IF/CASE/REPEAT) is done. The variable handling is pretty much done, but needs to grow a little to accommodate some new stack/local type. All the compilers bones are getting adjusted and fine-tuned, and 95% of the flesh is on. I'm really looking forward to being able to use it write programs for Prop2.
    www.mikronauts.com / E-mail: mikronauts _at_ gmail _dot_ com / @Mikronauts on Twitter
    RoboPi: The most advanced Robot controller for the Raspberry Pi (Propeller based)
  • Cluso99Cluso99 Posts: 15,452
    edited 2013-08-27 - 19:27:02
    Thanks Chip!
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • TonyDTonyD Posts: 207
    edited 2013-08-28 - 03:18:51
    Thanks for the update Chip. I'm genuinely excited about getting my hands on one :-)
    Tony
  • evanhevanh Posts: 8,033
    edited 2013-08-28 - 05:18:25
    Hero work in progress. Have a good break when this is all done, Chip.
    "We suspect that ALMA will allow us to observe this rare form of CO in many other discs.
    By doing that, we can more accurately measure their mass, and determine whether
    scientists have systematically been underestimating how much matter they contain."
  • NumPyNumPy Posts: 26
    edited 2013-08-30 - 09:04:03
    Any ideas what the technical name of the P2 might be? As in (P1 = P8X32A)
    And God said, "Let there be byte", and there was byte.
    God saw that the byte was good, and he separated the byte into bits.
    God called the first bit 1 and the second bit 0.
    And there was the 0 bit and there was the 1 bit, and they were the first code.
  • RaymanRayman Posts: 9,737
    edited 2013-08-30 - 13:47:44
    I've got my fingers crossed... I've got a few projects in mind that would be much better with P2...

    BTW: I think the Prop2 identifies the technical name already with the DE0 emulator. But, I don't remember what it was...
    Prop Info and Apps: http://www.rayslogic.com/
  • cgraceycgracey Posts: 11,734
    edited 2013-08-30 - 13:57:20
    The part name of the Prop2 is:

    P8X32C
  • Jeff MartinJeff Martin Posts: 602
    edited 2013-08-30 - 14:24:43
    One of the wafers we received was deemed bad by the fab, so a few minutes ago we broke the triple seal on the packaging of that wafer, pulled it out, and snapped a few quick pictures (thank you Emily!). Here's a couple of the best pictures (shrunk down for easy forum digestion).

    P2-Die-001 (Small).jpg
    P2-Die-020 (Small).jpg


    We will take better pictures when we have more time, but we wanted to get you something to look at for now.

    NOTE: The every-other-row placement is unexpected by us, and the structure placed in the "blank" rows is unknown. We are currently trying to figure out what that is. Chip thinks it may be a by-product of the MLR (multi-layer reticle) usage.
    679 x 626 - 121K
    1024 x 685 - 73K
    Jeff Martin
    Parallax Inc.
    (916) 624-8333 x3002
    jmartin@parallax.com
    http://www.parallax.com
  • cgraceycgracey Posts: 11,734
    edited 2013-08-30 - 14:25:32
    Jeff Martin got a picture of one of the new Prop2 wafers that didn't get sent off for packaging:

    P2-Die-012 (Cropped).jpg


    I believe that because we used a low-cost multi-layer reticle set, the fab's test structure was inserted into a blank chip space below each real chip.

    If you look at the center area of the chip that looks like a dado blade, you can see 8 mild concentrations of wiring. Each one is the center of a cog.
    1024 x 826 - 65K
  • __red____red__ Posts: 468
    edited 2013-08-30 - 14:25:44
    You know people are going to ask about the P8X32B :-)

    Much like people ask what the 8186 processor was between the 8086 and 8286.
  • jazzedjazzed Posts: 11,803
    edited 2013-08-30 - 14:31:35

    Chip, It looks like it's Spinning already.

    If we're lucky we might actually get a P8x32B.
  • Heater.Heater. Posts: 21,213
    edited 2013-08-30 - 14:41:58
    Fantastic to see such pictures. It's like seeing the ultrascan images of your new baby.

    @__red__

    What was the mystery about the 186? It was real. I was involved in a couple of projects that used the 80186. It was even used in some really cool "PC compatible" machines from Nokia complete with high res black and white displays, like early Macs, back when PC's were mostly 8086 and green screen text terminals.

    Those Nokia machines were supplied as systems with 80286 boxes running xenix as the central file server.
  • Beau SchwabeBeau Schwabe Posts: 6,416
    edited 2013-08-30 - 14:43:40
    FYI) based on an earlier question on number of die.... Looks like about 236 dies on the wafer. Figure about an 85% to 90% yield and that's 200 to 212 dies per wafer.


    Beau Schwabe --- Robotics applications- PCB design, embedded software, and mechanical
    Oklahoma Robotics -

    www.Kit-Start.com - bschwabe@Kit-Start.com ෴෴ www.BScircuitDesigns.com - icbeau@bscircuitdesigns.com ෴෴

  • localrogerlocalroger Posts: 3,269
    edited 2013-08-30 - 15:33:02
    __red__ wrote: »
    Much like people ask what the 8186 processor was between the 8086 and 8286.

    The 80186 was mostly used for embedded systems but it was very popular for that purpose. It was very similar to the 8086 but had some additional on-board peripherals which made it easier to design with but less appropriate for a general purpose desktop system. I've put thousands of them in service in my little corner of industry.
Sign In or Register to comment.