Shop OBEX P1 Docs P2 Docs Learn Events
IREAD clock cycles not emulated correctly in SX Sim 2.06.02? — Parallax Forums

IREAD clock cycles not emulated correctly in SX Sim 2.06.02?

ichidanichidan Posts: 8
edited 2005-10-30 17:34 in General Discussion
The manual says IREAD is a 4 cycle instruction, but the SX Sim emulates it as a 1 cycle instruction...

ireadtiming6wu.gif

Is this a bug / old version / or am i wrong?

Comments

  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-10-30 00:02
    ichidan,

    thanks for bringing this up. You did a nice job nicely animating your post - I like this!

    SXSim - by no means - is free of bugs, so there is a good chance that the emulation for IREAD is wrong. I'll check this, and let you know the results soon.

    BTW: Which version of SXSim are you using?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • James NewtonJames Newton Posts: 329
    edited 2005-10-30 04:47
    iread is 1 cycle in turbo mode and 4 in compatibility mode.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



  • ichidanichidan Posts: 8
    edited 2005-10-30 09:24
    Guenther Daubach said...
    ichidan,

    thanks for bringing this up. You did a nice job nicely animating your post - I like this!

    SXSim - by no means - is free of bugs, so there is a good chance that the emulation for IREAD is wrong. I'll check this, and let you know the results soon.

    BTW: Which version of SXSim are you using?

    SXSim version·2.06.02
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-10-30 10:50
    ichidan, James,

    according to the SX20/28 and the SX48/52 datasheets, the IREAD instruction takes four cycles in turbo mode, and not just one. Interstingly, the Ubicom SX20/28 datasheet states that one cycle is taken in compatibility mode, and four in turbo mode. If you look at other instructions, like CALL, it states 2 for compatible and 3 for turbo mode, or for a MOV instruction, it states 1 for both modes. The explanation for this can be found in the dataseheet as well:

    "The instruction execution time is derived by dividing the
    oscillator frequency by either one (Turbo mode) or four
    (Compatible mode). The divide-by factor is selected
    through the FUSE Word register."

    Nevertheless, this is a bit confusing, and should be corrected in a new version of the datasheet.

    Back to IREAD, I assume that four cycles are correct in turbo mode as the complete instruction pipeline will be dicarded - so I'm going to fix that in SXSim.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-10-30 16:22
    I did some more research on the IREAD question. In the Ubicom "SX User's manual, Rev 3.1", I found 4 clock cycles specified for IREAD in turbo mode in the instruction summary table on page 63, where the detailled description of IREAD on page 85 specifies only 3 cycles.

    So I wrote a little test application, and I could verify that IREAD indeed takes four clock cycles. So I'll fix SxSim accordingly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • James NewtonJames Newton Posts: 329
    edited 2005-10-30 17:34
    Well, I'll be danged... You learn something new every day. I've updated sxlist.com to reflect the timing Guenther verified.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



Sign In or Register to comment.