Shop OBEX P1 Docs P2 Docs Learn Events
Prop2 FPGA files!!! - Updated 2 June 2018 - Final Version 32i - Page 21 — Parallax Forums

Prop2 FPGA files!!! - Updated 2 June 2018 - Final Version 32i

11819212324160

Comments

  • jmgjmg Posts: 15,140
    Seairth wrote: »
    If Chip would add a command-line option to compile and another one to load the generated bin, then we can use our favorite editors and just shell out to PNUT for those two needs.
    Certainly a good idea !
  • cgraceycgracey Posts: 14,133
    So to reiterate what I said earlier about the outputs that they should be AND'ed rather than OR'd to allow any cog to pull a pin low without being blocked due to the fact that chip-enables and serial transmit and I2C and 1-Wire etc are all active low lines. The typical approach in P1 was to dedicate a cog to PASM for say the SD card and other cogs would pass commands and data via "mailboxes" to that cog. However even with P1 using Tachyon it was more effective to allow any cog to handle the device directly since the high-level routines were common and Tachyon code is fast. In many cases however the problem with this simple and efficient direct approach was the blocking effect of the OR'ed pins. One way around that was to make sure the active low outputs had pull-ups on them so they would at least idle high when released by a cog. Having AND'ed outputs solves all that and it still works the same way for any cog that wants to use an output except it "blocks" low.

    As for chip naming I can't see why it should be called something different since it clearly has the Propeller architecture characterized by eight or more independent cogs with 9-bit local source and destination address combined into conditional instructions connected to a common hub memory. Sure it has been enhanced to the hilt with interrupts and FIFOs and streamers and a Cordic solver etc etc but it still has these basic characteristics which distinguish it from all others.

    Pins' outputs can be inverted via the whole smartpin arrangement. Any any cog wrote a '1', the pin would go low.
  • cgraceycgracey Posts: 14,133
    edited 2015-11-03 00:50
    Tharkun wrote: »
    Hi,

    last week i bought a DE0-Nano on ebay (for a good price:)
    I play around with it and do some programming examples, it all works.

    For the first prop2 test i used the "DE0_Nano_Bare_Prop2_v3.jic" with USB-Serial-Prog like shown
    in "DE0_Nano_Bare_Prop2_Hookup" - no problems.

    Now i would like to use my self made DAC:

    DE0_DAC.jpg

    Do i have to use the "DE0_Nano_Prop2_v3.jic" image ?
    PNut finds no more Propeller 2 with this image or do i have to use other Prog-Pins ?
    I also try out GPIO_211/212/0 _IN_0 instead of GPIO_3/5/7.
    I'm a little bit confused. What is the exact difference between those both Nano-Images ?

    Thanks in advance

    Tharkun,

    Here is the pinout list that maps the DE0_Nano's FPGA pins to the DACs and everything:
    set_location_assignment PIN_D3 -to io[0] (P0..)
    set_location_assignment PIN_C3 -to io[1]
    set_location_assignment PIN_A2 -to io[2]
    set_location_assignment PIN_A3 -to io[3]
    set_location_assignment PIN_B3 -to io[4]
    set_location_assignment PIN_B4 -to io[5]
    set_location_assignment PIN_A4 -to io[6]
    set_location_assignment PIN_B5 -to io[7]
    set_location_assignment PIN_A5 -to io[8]
    set_location_assignment PIN_D5 -to io[9]
    set_location_assignment PIN_B6 -to io[10]
    set_location_assignment PIN_A6 -to io[11]
    set_location_assignment PIN_B7 -to io[12]
    set_location_assignment PIN_D6 -to io[13]
    set_location_assignment PIN_A7 -to io[14]
    set_location_assignment PIN_C6 -to io[15]
    set_location_assignment PIN_C8 -to io[16]
    set_location_assignment PIN_E6 -to io[17]
    set_location_assignment PIN_E7 -to io[18]
    set_location_assignment PIN_D8 -to io[19]
    set_location_assignment PIN_E8 -to io[20]
    set_location_assignment PIN_F8 -to io[21]
    set_location_assignment PIN_F9 -to io[22]
    set_location_assignment PIN_E9 -to io[23]
    set_location_assignment PIN_C9 -to io[24]
    set_location_assignment PIN_D9 -to io[25]
    set_location_assignment PIN_A8 -to inp[26]
    set_location_assignment PIN_B8 -to inp[27]
    set_location_assignment PIN_T9 -to inp[28] (..P28)
    set_location_assignment PIN_R9 -to inp_resn (PropPlug RESn)
    set_location_assignment PIN_E11 -to tio[86] P(58)
    set_location_assignment PIN_E10 -to tio[87] (P59)
    set_location_assignment PIN_C11 -to tio[88] (P60)
    set_location_assignment PIN_B11 -to tio[89] (P61)
    set_location_assignment PIN_A12 -to tio[90] (P62 / PropPlug RX)
    set_location_assignment PIN_D11 -to tio[91] (P63 / PropPlug TX)
    
    set_location_assignment PIN_B12 -to dac[1] (DAC_0, bit 0..)
    set_location_assignment PIN_R12 -to dac[2]
    set_location_assignment PIN_T12 -to dac[3]
    set_location_assignment PIN_R13 -to dac[4]
    set_location_assignment PIN_T13 -to dac[5]
    set_location_assignment PIN_T14 -to dac[6]
    set_location_assignment PIN_T15 -to dac[7]
    set_location_assignment PIN_F13 -to dac[8] (DAC_0, bit ..7)
    
    set_location_assignment PIN_N9 -to dac[10] (DAC_1, bit 0..)
    set_location_assignment PIN_P9 -to dac[11]
    set_location_assignment PIN_N12 -to dac[12]
    set_location_assignment PIN_R10 -to dac[13]
    set_location_assignment PIN_P11 -to dac[14]
    set_location_assignment PIN_R11 -to dac[15]
    set_location_assignment PIN_T10 -to dac[16]
    set_location_assignment PIN_T11 -to dac[17] (DAC_1, bit ..7)
    
    set_location_assignment PIN_N16 -to dac[19] (DAC_2, bit 0..)
    set_location_assignment PIN_R14 -to dac[20]
    set_location_assignment PIN_P16 -to dac[21]
    set_location_assignment PIN_P15 -to dac[22]
    set_location_assignment PIN_L15 -to dac[23]
    set_location_assignment PIN_R16 -to dac[24]
    set_location_assignment PIN_K16 -to dac[25]
    set_location_assignment PIN_L16 -to dac[26] (DAC_2, bit ..7)
    
    set_location_assignment PIN_J14 -to dac[28] (DAC_3, bit 0..)
    set_location_assignment PIN_J16 -to dac[29]
    set_location_assignment PIN_K15 -to dac[30]
    set_location_assignment PIN_M10 -to dac[31]
    set_location_assignment PIN_L13 -to dac[32]
    set_location_assignment PIN_L14 -to dac[33]
    set_location_assignment PIN_N14 -to dac[34]
    set_location_assignment PIN_N15 -to dac[35] (DAC_3, bit ..7)
    

    You'll need this document to bridge the FPGA pin numbers to the DE0-Nano pinout:

    http://www.terasic.com.tw/cgi-bin/page/archive_download.pl?Language=English&No=593&FID=75023fa36c9bf8639384f942e65a46f3
  • cgraceycgracey Posts: 14,133
    edited 2015-11-03 00:31
    potatohead wrote: »
    Hey, chip wanted to fill event slots. This is a good suggestion.

    Perfect!!!

    On second thought, maybe worthless. The thing is, you would be much more interested in tracking milliseconds, or something, all along the way, rather than knowing that this big long-period counter just rolled over. It's rollover event may not tie meaningfully to anything practical.

    What do you think?
  • Hey Chip is composite/component/VGA colour conversion going back in? :D
  • cgraceycgracey Posts: 14,133
    Propeller e2
    Baggers wrote: »
    Hey Chip is composite/component/VGA colour conversion going back in? :D

    Yes. It will click on after the streamer, so it doesn't really disrupt anything.
  • cgracey wrote: »
    potatohead wrote: »
    Hey, chip wanted to fill event slots. This is a good suggestion.

    Perfect!!!

    On second thought, maybe worthless. The thing is, you would be much more interested in tracking milliseconds, or something, all along the way, rather than knowing that this big long-period counter just rolled over. It's rollover event may not tie meaningfully to anything practical.

    What do you think?

    I'm not following, but you are right. We don't need it.

    That's because we already have it:
    mov ijmp3, #isr
    mov t1, #0
    addct3 t1, #0
    setint3 #3
    
  • potatoheadpotatohead Posts: 10,253
    edited 2015-11-03 02:49
    I think people can use the timers most of the time. Having a CNT rollover is of marginal value in that sense. But, it's also a simple bit of code that can be included, and it may make great sense for people not using interrupts much at all.

    If nothing better comes along, perhaps it still makes sense to add it to one of the unused event numbers.

    Edit: And there it is! No worries. We shouldn't add it.

  • jmgjmg Posts: 15,140
    Seairth wrote: »
    I'm not following, but you are right. We don't need it.

    That's because we already have it:
    mov ijmp3, #isr
    mov t1, #0
    addct3 t1, #0
    setint3 #3
    
    Is there still a CNT, or is it now one of CT1,CT2,CT3 ?


  • SeairthSeairth Posts: 2,474
    edited 2015-11-03 03:46
    jmg wrote: »
    Seairth wrote: »
    I'm not following, but you are right. We don't need it.

    That's because we already have it:
    mov ijmp3, #isr
    mov t1, #0
    addct3 t1, #0
    setint3 #3
    
    Is there still a CNT, or is it now one of CT1,CT2,CT3 ?


    Well, there is still a system counter/clock that can be retrieved with GETCNT. CT1, CT2, and CT3 are internal registers that get compared against the system counter and set event flags/interrupts. ADDCTx is used to set those registers. In the case above, I just set CT3 to trigger an interrupt when the system counter rolls around to zero.

    Edit:

    I wonder if all that's really necessary is:
    mov ijmp3, #isr
    pollct3
    setint3 #3
    

    Assuming that the registers initialize to zero, just clear the pending event on startup...
  • jmgjmg Posts: 15,140
    cgracey wrote: »
    Perfect!!!

    On second thought, maybe worthless. The thing is, you would be much more interested in tracking milliseconds, or something, all along the way, rather than knowing that this big long-period counter just rolled over. It's rollover event may not tie meaningfully to anything practical.

    What do you think?
    It could be used as a system watchdog, and/or time-base extension.
    If there is a spare event lot, this seems a good use, and it does not consume a CT register, just to manage > 32b times.
    Even something as simple as time-since-last-reset could be useful in the field.

  • Seairth wrote: »
    If Chip would add a command-line option to compile and another one to load the generated bin, then we can use our favorite editors and just shell out to PNUT for those two needs.

    Chip,

    Is this something you could easily/quickly do along with the next FPGA release?
  • RamonRamon Posts: 484
    edited 2015-11-03 13:08
    (sorry, posted in the wrong thread)
  • RaymanRayman Posts: 13,805
    Can a REP contain another REP?

    I'm guessing it can't..
    But, if it can, does it count as an instruction?
  • ElectrodudeElectrodude Posts: 1,614
    edited 2015-11-03 18:46
    Rayman wrote: »
    Can a REP contain another REP?

    I'm guessing it can't..
    But, if it can, does it count as an instruction?

    It can't. I'm not sure what would happen if you tried - I suspect the first REP would be canceled by the second REP. The other possibility would be that the second REP would count as a NOP (which would count as 1 instruction).

  • jmgjmg Posts: 15,140
    Rayman wrote: »
    Can a REP contain another REP?

    I'm guessing it can't..
    But, if it can, does it count as an instruction?
    I don't think it can, as that is more HW, and more complexity.

  • There is just one REP circuit. A second REP, would need a test. I expect it would nullify the first one and continue as if it is the only REP active.

    That circuit has enough to loop and count with zero overhead.

    That's it.
  • Perhaps PNut could test for nested REP instruction and issue an error upon detection.
  • cgraceycgracey Posts: 14,133
    Seairth wrote: »
    Seairth wrote: »
    If Chip would add a command-line option to compile and another one to load the generated bin, then we can use our favorite editors and just shell out to PNUT for those two needs.

    Chip,

    Is this something you could easily/quickly do along with the next FPGA release?

    I'll look into it.
  • cgracey wrote: »
    Propeller e2
    Baggers wrote: »
    Hey Chip is composite/component/VGA colour conversion going back in? :D

    Yes. It will click on after the streamer, so it doesn't really disrupt anything.

    Nice one :D
  • RaymanRayman Posts: 13,805
    Was just copy and pasting the P1 multiply example:
    :loop  if_c     add     y,x       wc     'if c set, add multiplicand to product
    

    and got an error on the colon. I think I see we switched at some point to a period.
    So, I guess I have to make it ".loop".

    Does the reason for making that change still exist? I can't find any other use of colon...
  • jmgjmg Posts: 15,140
    edited 2015-11-04 21:22
    Rayman wrote: »
    ... I think I see we switched at some point to a period.
    So, I guess I have to make it ".loop".

    Does the reason for making that change still exist? I can't find any other use of colon...

    Universal in other assemblers is colon after a label
    LabelN:
    ; and some have period for local names, or some local label prefix (or suffix...)
    .LocalName
        Call LabelN
    

    Given Prop GCC includes an Assembler(as), now seems a very good time to morph the PNUT syntax, so it has fewer incompatibilities.

    Even as has some variances in documents
    This https://sourceware.org/binutils/docs/as/Symbol-Names.html
    gives
    "By default, the local label prefix is '.L' for ELF systems or 'L' for traditional a.out systems, but each target may have its own set of local label prefixes"

    and this
    http://tigcc.ticalc.org/doc/gnuasm.html#SEC48L
    is mostly the same, but misses the above '.L'comment
  • cgraceycgracey Posts: 14,133
    There is no current use of colons in the assembler.

    Local labels start with a period now.
  • jmgjmg Posts: 15,140
    cgracey wrote: »
    There is no current use of colons in the assembler.
    Does that mean PNUT can now tolerate this as format Label syntax ?

    LabelN:

    cgracey wrote: »
    Local labels start with a period now.
    OK. I think that comes under the as comment above.
  • RaymanRayman Posts: 13,805
    Well, if it's not too late, I'd vote for going back to colon...

    It's pretty powerful be able to copy and paste P1 code into P2 and have it work...
  • cgraceycgracey Posts: 14,133
    Rayman wrote: »
    Well, if it's not too late, I'd vote for going back to colon...

    It's pretty powerful be able to copy and paste P1 code into P2 and have it work...

    There are some subtleties between the two architectures that make copying and pasting a tricky notion, though.
  • RaymanRayman Posts: 13,805
    Still, I imagine porting some amount of P1 code to P2 and anything that makes it easier would help.

    BTW: I very rarely use ":", it's mostly Chip's code that seems to have them everywhere...
  • jmgjmg Posts: 15,140
    Rayman wrote: »
    Well, if it's not too late, I'd vote for going back to colon...

    It's pretty powerful be able to copy and paste P1 code into P2 and have it work...

    Copy-Compatibility with P1 went out the window a long time ago, and to me, it is more important to be able to easily use the same P2 ASM code in the two assemblers that will support P2. (and of course, any ASM code for P1 done in as )
    Some translation software scripts can be used to help move P1 PASM to P2

  • RaymanRayman Posts: 13,805
    I don't know, I think the basics are still the same...
    To me, it looks like just the fancy instructions are different.

    I just copied and pasted the multiply routine from the P1 manual and it worked, except for the this ":" business.

    I think a lot of my P1 code would work nearly as is too.
  • There is some value in maintaining as much compatibility as possible between the P1 and P2 assembly syntax. I think that a lot of the code from the OBEX will be ported to P2, and it would be nice to minimize the amount of changes required to do this. Of course, P2 has many more features than P1 and some changes are necessary. However, I think it is best to avoid arbitrary changes that don't really provide any benefit. I think the change from ":" to "." was an arbitrary change that wasn't necessary.

Sign In or Register to comment.