Shop OBEX P1 Docs P2 Docs Learn Events
Propeller II: Emulation of the P2 on FPGA boards (Prop123-A7/A9, DE0-NANO, DE2-115, etc) - Page 2 — Parallax Forums

Propeller II: Emulation of the P2 on FPGA boards (Prop123-A7/A9, DE0-NANO, DE2-115, etc)

2456724

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-11-29 00:12
    Sapieha wrote: »
    Hi Peter.

    Why You place Stack in COG -- If You can use CLUT for that ?
    When you are treading on new ground you don't go optimising before you can crawl. I need to see it functional, what works, what doesn't, changing things bit by bit etc. Of course I will be utilizing the P2's many powerful features, but not straight away. At the moment I trying to find how I can access hub RAM to read a string. The normal method doesn't appear to work.
  • jmgjmg Posts: 15,173
    edited 2012-11-29 00:18
    When you are treading on new ground you don't go optimising before you can crawl. .

    Plus it is quite good to get a 'before snapshot' of Prop 1 code, ported without optimize added, but at the reference Prop 2 clock speed.
    Then you have a base to see the Size/Speed gains from the new opcodes and new HW.
  • AleAle Posts: 2,363
    edited 2012-11-29 00:25
    I'll have to order From Digikey... that is a bit messy with the delivery.... will be someone ordering from Germany? I'll have to check at uC net to see if someone makes a digikey Sammelbestellung...
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-11-29 00:50
    I've written some basic debug routines even though they probably are already in the monitor and used these to dump hex or ascii data. Here's a quick ASCII dump.

    TACHYON P2
    0000: Prop2.0 . |..L|.E~A.c6|..F|..F|..F|..F|b.^|0d.(..B|.*\|zZ>|.{x<
    0040: Z>|.{x<..x|(zn| Z>|..J|b*.d.2J|a.J|4.n|v.o| .n|.RJh .J|b%R|.Z4|.
    0080: %R|._4|.%R|.[4|.%R|.2J|a.J|4.n|v5.|..t|.`t<.bD<.7O|...L..n| [2|.
    00C0: Z0|.D>@.Z2|..n|a.BL'\.|.[0|.Z0|.+n|v2V|.dn< p| Z>h.V,T.[0T.Z0T.
    0100: .r|48p|vAr|.7n|v@.@.o..`AlS.`.|.jR<.f..`.n| jl..jr<.Hr|zGn|v..|.
    0140: B.@.`.|.0r|.Ap|..rh.lV(.A~...Z|.An|.An|.p^<jrb(j.ZT nZ<.%R|..v|.
    0180: %R|..v|.|v<...|.@T..................P...............L...@.......
    01C0: ........[4..J`}.F.|...~...~x3.~.OK= .J},.J}(.J}...~(..|...~t..~t
    0200: !.~t.0}...|.5.|...~ dJ=aA.r.6.~lL&|...T.A.@..O.`vo. .n.l.F} ..|.
    0240: A.~.L&|..J}v..|.,F}x5.|.@.@.g..`vo. T.}.@.@....`vo. ..|T`H} 5.|.
    0280: ...`.J} A.@.v.. ..~$A.~./J}v..|.dL= .L},..~ L&|.d.> ?.~`8.~...~
    02C0: 8.T..H}a.Lq$f.2 L&|.>.T.@.@.w~.`vo. @.@..n.`vo. .F} .H} ..|.O.>.
    0300: .H}..H}b..(.?H}b..hTT.i...|.S^@../.`y..`vo. w.. ..~$w..l..~ .nC(
    0340: Oo.lvo.....`v.. O!> . ~$O!>l. ~ ..~(P.>lOo..{..`vo..@.@.w..`vo.
    0380: d~@..G.`M.> L.>lK.>`M.>lK!> . ~$K!>l. ~$K!>l. ~ P.>.w...v...N.>.
    03C0: I!> H!>`G!>hI.> H.>hN!>`G.> ..~$G.>l..~$G.>l..~ N!>.M.> L.> K.>
    0400: J.> I.> H.> G.> O.>.O.> P.>.@.@.Go.`vo....|.........jjjjgf.j..g;
    0440: rsn<:uO%.R.Q.h..+Y...M`[./.B.D7qO{@5%[5i[BV9q.qY$.?.U^.+.*.X.[..
    0480: >.1$C}.Ut]>r~1^.'.\.tq.AAi.d.G>oF.A.L!.$o,i-*.tJ\)0\Z.yvRQ>.mF1(
    04C0: H'.0G.Y?s.`FG.'UQcJ.g))...7'8!..|m,M..8STs.e;.jv.IB..,r.!h?"Kf.(
    0500: p.KB#QlG.h.Q$..V.5.tp j..A$..l7.LwH'5<043..9J*XNOJ.[so.hn..toc%x
    0540: .xH...G.z.>.klP$w#y>rxqF..,Y-W.N4.=/W:#M/L0H1T2Z3R Q??.:.: &.>/U
    0580: :.@.*.+!-/L0H1T2Z3R.#8|=\.;.; ?/S:a>a<y^...=== Propeller II Moni
    05C0: tor ===...? - Help...Hit SPACE. '.'.. -..{adr{.adr}}.{dat{ dat}
    0600: }.adr..~HUB..`View../.`Search..:.`Enter.*.*[</>]*`Move.*.*^`Chec
    0640: ksum.*@`Watch.[Y/W/N]`Byte/word/long.~COGS.cog+*{+*}`Start.cog-`
    0680: Stop.M`Map.~PINS.{pin}[H/L/T/Z/R]`High/low/toggle/off/read.pin#`
    06C0: Watch.pin|cfg`Configure.dat\`Set DACs.~MISC.dat*`Set clock.'`Rep
    0700: eat.Q`Quit......@:@.X..`.lS .0...2...2.([2...4..45...x..K"|..j.x
    0740: .Z..K2|..N. TB}.*.|.2"|.qg~.k.~.-w~.18kx..|...~.$.|.-w~.!.T.^i}T
    0780: 2.|.B.}.2d|...|.a?? di}T2>|.B.}.:.|.,w~.7.h.aA? 2.|.B.}.;.|..N."
    07C0: .Nk".Nk TB}...|..@. Ka~...|..@. Ka~...|..@. La~...|._A? Na~...|.
    0800: b?? iA? I&}..I~.2>.....`.8. gP}.vC..M.h.g??.`??.A.x._E? iE?`..|.
    0840: e9?iD.L.eA? hA?,_A?.;.|.I&}..:. _G? iG?`.I~.[:.ze=? .<..3F..vC.
    0880: iT}.\<.v.F....|.\;? I&}.)W~.iC?LiC?`<:.._9+ a?+ \C+ a??.^93 h93,
    08C0: \?3.\C3.~Nql~Rql2>..3B..gP}.iT}.s<.v~Nql~Rql..|.I&}.2>..gP}.a;?.
    0900: {<.v]C? .L. ......|.hJ}R.L. fJiPgM+ .Lk,bP}.a=? .....A..$Y....T.
    0940: bP}.^C?...h...|.2z|.qg~..>..!G.. 8....T...|.`>..)W~.a;? .B. +8..
    0980: )Wj.a;?...|..>...>....|..:. .A..]9? .8..]9?.08O 18s M8k .A...:..
    09C0: $.L...|.Zj}R[jiRYjiRXjiRVjiP_I? VH..'.h...|.)W~.c>..#>..a??h..|.
    0A00: U>....|.2\}.qg~...|.44..A<...<.xA:..\;?nC.T.^.<.i??Li??`iA?LiA?`
    0A40: _A?...p.`=? _=?.h=?(.<....|..N.a.O}..S}..N.a.O}..S}.gQ? .P.(gS?
    0A80: .R..TS?liE?`iG?`..|.V>...BO .Bs h.|.2>..AB....|.AC....|.".|.>8.
    0AC0: .A..!G..'8..v.T..8...AW.q.T...|.!G...8....h..8...8W...h. 8..~8Oa
    0B00: u.p.*8....|.&.p..AO.u.|...|.(8W..AW..AW..8W..AW.&.T.u.|.*.|.".|.
    0B40: U9? .A....|..6. ...`,w~.%QV. 8....h.'8.. .T.$.|..8..'8....h. 9.x
    0B80: \C? %Q~...|..6..[K. eG>T...d..|..6.i..p.am. ..|.,w~...h...|.$.|.
    0BC0: .B."<.~..8..A.~..Bs,\C3h/.p.&.|.<.~.A.~..8s.`8.a{8s. 8s...|..8..
    0C00: 8..<.h.&.|...|./8.a:8s..8s.@8OaG8s. 8s.`8Oag8s.W8s...|.b?? iA?`
    0C40: _A?.I&}._E? bC? .L. .....A..g9? .8.<^?? \??L_A? hA?,_=?.2D..gP}.
    0C80: gM? .L.,.....A..\?.v2.}.qg~.2D..A8.. 8..~8Oa.8s .A..eA.v.D..2.}.
    0CC0: qg~.$Y..P=kz..|.44..A8...8.x.8.b(eV.38W.54W.r.T.`8...:k`~8W..:k.
    0D00: .Ak.};kv.Ak.r.h..8....j..:k .AW..:W.r.|.f;? .:.,]C? f;? .B.$a9?
    0D40: .A...;.v..|.V9? ..|. 8. ..|..8.`.8..08s.78O..8.,i9...6..u7?..6..
    0D80: .8.)\2...9.z..|.$Y..!.h...|..T.h.V..jW...VW."TW..8W..TW."VW...|.
    0DC0: ..|.#.i..\. uY?$.X.821.x.X...Z.0uY?..X..V0..4].v.Z.(+Z..-.|.X/?T
    0E00: %/..p...oe. .dO(rg.$oe..og..pi. .hO.ri.asi..qi. .hO.ri.asi..q_..
    0E40: .^O(ok. p_? qa? :b..=c.zQ.|......(..-.......$;I.== End of ROM ==
    0E80: .|? .F| .F|,.F<v3n|.3n|.TH| R6|.AH| R6|.CH| R6|.HH| R6|.YH| R6|.
    0EC0: OH| R6|.NH| R6|. H| R6|.PH| R6|.2H| R6|..F| #X|...|.cH<...h.R6|.
    0F00: .F|...|.. ..c.= ".= ?.}b8~h..H<..H<.-d|...}.%.}v..|..H|` H|..H|.
    0F40: .Hx R6|...|..H| R6|..H| R6|...|.3n|..H< @.|.:H| R6|. H| R6|...|.
    0F80: d.= .H|(F.|..H< F.|...|.d.= .H|(L"|..H< L"|...|..H|`0H|.:H|..HL.
    0FC0: R6|...|..I|h.H|,.B| .@|..@<..H|).t?p.@<|WB|v..|.................
    1000: ................................................................
    1040: ................................................................
    1080: ................................................................
    10C0: ......HELLO WORLD...............................................
    1100: ................................................................
    1140: ................................................................
    1180: ................................................................
    11C0: ................................................................
  • Heater.Heater. Posts: 21,230
    edited 2012-11-29 01:00
    Seems that all they say about Forth is true. It will be the first programming language up and running on this new architecture.
  • TorTor Posts: 2,010
    edited 2012-11-29 01:04
    Did anyone find the best way/place to order a DE0-Nano when you live in Northern Europe? I tried Terasic, but the shipping kills me. I won't bother with DigiKey, because they only ship with UPS and that adds lots of extra cost for me. I've found some "local" distributors (via Altera's pages), but they double the price to start with, _plus_ shipping with couriers.

    -Tor
  • LeonLeon Posts: 7,620
    edited 2012-11-29 01:39
    I got mine from Digi-Key with free shipping to the UK as it was over £50. I had to pay VAT to the UPS man.
  • TorTor Posts: 2,010
    edited 2012-11-29 02:09
    Thanks Leon. I may have to go that route, but.. even though I should get free shipping from DigiKey at that price as well, in practice it's costly. UPS adds a handling charge which is more than the VAT, then they charge VAT on the supposedly free shipping, and finally they don't charge VAT on the actual value of the goods, they'll (usually, although not always) add some random, not insignificant amount to the value and charge VAT (25%) on _that_. And if you ask them to fix the error, they'll say "Sure, just pay us this extra charge to re-calculate the transaction and we'll do it. It'll cost you more than ever but..". So it's very difficult not to end up paying nearly twice the DE0 price in practice. The worst part is that you'll never know in advance how much it'll be. When shipping by USPS, in contrast, I always know the exact costs from the start.

    I'll still investigate getting a DE0-Nano though - or bite the bullet and wait for the P2 itself! :)

    -Tor
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-11-29 02:23
    Tor wrote: »
    I'll still investigate getting a DE0-Nano though - or bite the bullet and wait for the P2 itself! :)

    -Tor

    That's the exact reverse because the expression means if you bit the bullet you would take a chance and get into right away and get a Nano! :)

    BTW, my Tachyon P2 kernel is coming along nicely. Should have something to release soon hopefully.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-11-29 02:42
    Where do I get the P2 compiler from? I presume there is one since the Monitor has the P2 instructions in it.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-11-29 02:54
    Cluso99 wrote: »
    Where do I get the P2 compiler from? I presume there is one since the Monitor has the P2 instructions in it.

    From Chip's post here
  • Heater.Heater. Posts: 21,230
    edited 2012-11-29 02:55
    What, you think Chip can't assemble ops into binary in his head? We used to for the 6809 back in the day.
    But I do suspect he ha a hacked up assembler somewhere.
  • TorTor Posts: 2,010
    edited 2012-11-29 02:58
    That's the exact reverse because the expression means if you bit the bullet you would take a chance and get into right away and get a Nano! :)
    You're right of course - I started out with another expression/idiom but I wasn't sure if that one translates to/exists in English so I replaced it at the last moment. That doesn't always work! :)

    -Tor
  • LeonLeon Posts: 7,620
    edited 2012-11-29 03:00
    Tor wrote: »
    Thanks Leon. I may have to go that route, but.. even though I should get free shipping from DigiKey at that price as well, in practice it's costly. UPS adds a handling charge which is more than the VAT, then they charge VAT on the supposedly free shipping, and finally they don't charge VAT on the actual value of the goods, they'll (usually, although not always) add some random, not insignificant amount to the value and charge VAT (25%) on _that_. And if you ask them to fix the error, they'll say "Sure, just pay us this extra charge to re-calculate the transaction and we'll do it. It'll cost you more than ever but..". So it's very difficult not to end up paying nearly twice the DE0 price in practice. The worst part is that you'll never know in advance how much it'll be. When shipping by USPS, in contrast, I always know the exact costs from the start.

    I'll still investigate getting a DE0-Nano though - or bite the bullet and wait for the P2 itself! :)

    -Tor

    Farnell now stocks them (cheaper than Digi-Key):

    http://uk.farnell.com/terasic-technologies/p0082/dev-bd-de0-nano-fpga-cyclone-iv/dp/2076463?Ntt=DE0-Nano

    That might be your best source.

    They also have the DE2-115.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-11-29 04:23
    Chip, the editor in PNUT is a bit basic and I have a large file but rather than worrying about that at present it is easy enough to use another editor as long as PNUT checks and refreshes it's copy of the file. Are there any quick hints you can share? I have my kernel fully compiled but need to debug it now to bring it up fully.
  • Bill HenningBill Henning Posts: 6,445
    edited 2012-11-29 06:29
    Chip,

    - What resistor values are you using for the 9 bit video R2R dac's?

    - does the P2 emulator support old-style 8 bit parallel VGA ports?

    - does the P2 emulator support old-style 3/4 bit resistor dac video output?

    I've also considered using the 16 bit port (on the 34 pin connector) as 4x 4 bit DAC's, treated as 9 bit dacs by the software. This would allow 4096 colors (out of 2^27) but leave a lot of digital pins free on the nano. For more colors, use the 16 bits as R5G5B4HV for VGA... 16K colors, with simple non-R2R dac's.
  • cgraceycgracey Posts: 14,153
    edited 2012-11-29 08:54
    Chip, the editor in PNUT is a bit basic and I have a large file but rather than worrying about that at present it is easy enough to use another editor as long as PNUT checks and refreshes it's copy of the file. Are there any quick hints you can share? I have my kernel fully compiled but need to debug it now to bring it up fully.

    I don't have any tips. I just stay in PNUT, myself. It's minimal, but reliable. No scroll bars.
  • cgraceycgracey Posts: 14,153
    edited 2012-11-29 09:18
    Chip,

    - What resistor values are you using for the 9 bit video R2R dac's?

    - does the P2 emulator support old-style 8 bit parallel VGA ports?

    - does the P2 emulator support old-style 3/4 bit resistor dac video output?

    I've also considered using the 16 bit port (on the 34 pin connector) as 4x 4 bit DAC's, treated as 9 bit dacs by the software. This would allow 4096 colors (out of 2^27) but leave a lot of digital pins free on the nano. For more colors, use the 16 bits as R5G5B4HV for VGA... 16K colors, with simple non-R2R dac's.

    On the Prop2, every pin has a 75-ohm 9-bit DAC and colors are always handled as RGB, not levels and shifts and all that TV modulation stuff. Every cog has a modulator that will make the TV signals for you (chroma, luminance). Because the colors are kept in numeric RGB format (8-bits per color) and the output is scalable, trying to get by with less than a 9-bit DAC could get ugly unless you set your color scaling to respect, say, 3-bit boundaries. This needs to get documented.

    As far as the DAC resistor values go, the R value should be around 65 ohms for 3.3V drivers. The FPGA pins have a fairly steady impedance of about 20 ohms, which must be accounted for on the driver legs by reducing the 2R value from about 130 ohms down to 110 ohms (130 ideal - 20 for the pin). Meanwhile, the bottom 2R leg of the DAC should be built from 2 of the R values in series, as ground is 0 ohms.
  • Bill HenningBill Henning Posts: 6,445
    edited 2012-11-29 09:26
    Thanks for the explanation, I really like that bitmaps can be kept in RGB and the P2 will take care of turning them into video.

    Sounds like using the 16 bit port is not practical for VGA out - time for me to see if I have enough 65 and 110 ohm resistors in stock... or get some from digikey.
    cgracey wrote: »
    On the Prop2, every pin has a 75-ohm 9-bit DAC and colors are always handled as RGB, not levels and shifts and all that TV modulation stuff. Every cog has a modulator that will make the TV signals for you (chroma, luminance). Because the colors are kept in numeric RGB format (8-bits per color) and the output is scalable, trying to get by with less than a 9-bit DAC could get ugly unless you set your color scaling to respect, say, 3-bit boundaries. This needs to get documented.

    As far as the DAC resistor values go, the R value should be around 65 ohms for 3.3V drivers. The FPGA pins have a fairly steady impedance of about 20 ohms, which must be accounted for on the driver legs by reducing the 2R value from about 130 ohms down to 110 ohms (130 ideal - 20 for the pin). Meanwhile, the bottom 2R leg of the DAC should be built from 2 of the R values in series, as ground is 0 ohms.
  • Bill HenningBill Henning Posts: 6,445
    edited 2012-11-29 10:59
    IT'S ALIVE!!!!!

    Add one more working Propeller 2 emulation on DE0-Nano to the list.

    Thanks Chip!
  • TrapperBobTrapperBob Posts: 142
    edited 2012-11-29 11:03
    Mine is ALIVE also !!!!!

    Add another working Propeller 2 emulation on DE0-Nano to the list.

    Many thanks Chip and all a Parallax !

    What a GREAT company!!!!!!
  • LeonLeon Posts: 7,620
    edited 2012-11-29 12:15
    Where do I find the P2 compiler for the DE0_Nano_Example.spin file? Is it DE2_115_Prop2.zip?

    I've loaded the emulation into the DE0-Nano board.
  • David BetzDavid Betz Posts: 14,516
    edited 2012-11-29 12:17
    Leon wrote: »
    Where do I find the P2 compiler for the DE0_Nano_Example.spin file? I've loaded the emulation into the DE0-Nano board.
    The compiler is built into the PNut.exe IDE.
  • SapiehaSapieha Posts: 2,964
    edited 2012-11-29 12:18
    It is file PNut.exe that You can find in zip file

    Leon wrote: »
    Where do I find the P2 compiler for the DE0_Nano_Example.spin file? Is it DE2_115_Prop2.zip?

    I've loaded the emulation into the DE0-Nano board.
  • Roy ElthamRoy Eltham Posts: 3,000
    edited 2012-11-29 13:08
    I have an FPGA emulation of the Prop2 running also. I'm using a Stratix III board, but the functionality is similar to the DE2-115 setup (6 cogs, 128kb ram, etc.)

    I'm starting on the port to C/C++ of the x86 asm code for Prop2 ASM. It's largely the same as the Prop1, just with some new things added in, and a bigger table of instructions, so it shouldn't take to long for me to have a version up and running. However, I am working on a few other things for Parallax simultaneously, so please forgive me if it takes longer than you want. :)

    In the short term, it will be a fork of the existing Prop1 program up on google code, and I'll just post it here on the forums. Long term it'll be integrated into the same project so one compiler will be able to do both.
  • LeonLeon Posts: 7,620
    edited 2012-11-29 13:21
    Sapieha wrote: »
    It is file PNut.exe that You can find in zip file

    Thanks. My Prop Plug is on COM30 and PNut.exe only works from COM1 to COM9! It looks as though a new version of PNut.exe is required for me.

    When the FPGA is configured, one of the green LEDs is on. Does that indicate that it is configured OK?
  • SapiehaSapieha Posts: 2,964
    edited 2012-11-29 13:28
    Hi Leon

    --- You need remap that port in Window - Hardware control

    Leon wrote: »
    Thanks. My Prop Plug is on COM30 and PNut.exe only works from COM1 to COM9! It looks as though a new version of PNut.exe is required for me.

    When the FPGA is configured, one of the green LEDs is on. Does that indicate that it is configured OK?
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-11-29 13:37
    You can change the enumeration of your prop plug to something other than 30...

    For WindowsXP here are the steps:

    Start-->Control Panel--> System --> Hardware --> Device Manager

    Look under Ports (COM & LPT) --> Find the item that says USB Serial Port (COM30) --> Select Port Settings --> Advanced

    Under COM Port Number select a COM port between 1 and 9

    Note: even though it says that it's in use, doesn't mean that it's active, just that it's been enumerated before. usually only COM1 and COM2 are active, sometimes up to COM4. Just stay out of that range and you should be fine unless you know specifically that another COM port is in use.

    A warning will show up about changing the port number and possible conflicts... as long as this port isn't being used you can just click OK

    The Device Manager will still show COM30 until you refresh it... close and then re-open.

    After that you should be done with a NEWly enumerated comport. No restart necessary. :-)
  • LeonLeon Posts: 7,620
    edited 2012-11-29 13:38
    Thanks. It's recognised by the Prop Tool.

    All the lower COM ports were in use, but I remapped it to COM1. I'll have another go.
  • TubularTubular Posts: 4,702
    edited 2012-11-29 13:41
    Leon, first redirect one of the com1-9 away from there eg to com31, freeing up that slot. Then move your prop plug into the freed up low com number
Sign In or Register to comment.