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

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

12425272930160

Comments

  • evanhevanh Posts: 15,258
    potatohead wrote: »
    Agreed. This would be good to change. Pixel output order is backward. And making low bit rate bitmaps in linear order is something people will do a lot of. It's just frugal use of RAM.

    Little Endian's backwardness strikes yet again.
  • cgraceycgracey Posts: 14,133
    Rayman wrote: »
    If you want more birds, you have to go widescreen :)
    Here's WVGA (852x480):
    (it shimmers a little tiny bit, probably due to the pixel clock not being even divisor of 50 MHz clock)

    Rayman, change the XCONT that initiates the hsync pulse to XZERO. That will cause each line to be output with each pixel having a constant NCO value (i.e. pixel 100 will always have the same NCO value and, therefore, the same time offset on the scan line. That should take care of the shimmer.
  • cgraceycgracey Posts: 14,133
    Rayman wrote: »
    Just got 800x600 (SVGA) at 72 Hz working with 50 MHz pixel clock:

    BTW: I'm wondering why the buffering of xcont doesn't make the vertical sync signal come out wrong... Or, maybe it is wrong but works anyway?

    It doesn't come out wrong because there are always several XCONTs that make a scanline.
  • cgraceycgracey Posts: 14,133
    So, for RDLONG lookup modes, 1/2/4-bpp, the byte order is correct, but the bit groups come out backwards? I agree that this should be straightened out. Did I characterize the problem properly?
  • cgraceycgracey Posts: 14,133
    So, for RDLONG lookup modes, 1/2/4-bpp, the byte order is correct, but the bit groups come out backwards? I agree that this should be straightened out. Did I characterize the problem properly?
  • potatoheadpotatohead Posts: 10,255
    edited 2015-11-19 18:42
    Yes. That's exactly what are seeing.

    If the fix is in, my 8x8 driver should deliver mirror image characters, and the font reverse routine at the beginning can be commented out.

    Or Rayman's 2 color bitmap won't need whatever REV instruction it's got to sort the image out.


  • cgraceycgracey Posts: 14,133
    potatohead wrote: »
    Yes. That's exactly what are seeing.

    If the fix is in, my 8x8 driver should deliver mirror image characters, and the font reverse routine at the beginning can be commented out.

    Or Rayman's 2 color bitmap won't need whatever REV instruction it's got to sort the image out.


    Super! I'll get this fixed.
  • RaymanRayman Posts: 13,994
    edited 2015-11-19 20:29
    Great. That'll be best for me, unless there's some reason not to change the bit/nibble order.
    Be interesting to see if 2-bit color comes out right...

    I guess this doesn't need immediate fixing, since it can be rectified with the added code for now...
  • jmgjmg Posts: 15,149
    Rayman wrote: »
    I guess this doesn't need immediate fixing, since it can be rectified with the added code for now...

    True, but the benefit of fixing it now, is it can be tested now, and anything it breaks can be found.
    It does not sound like a complex fix.

  • cgraceycgracey Posts: 14,133
    Rayman wrote: »
    Great. That'll be best for me, unless there's some reason not to change the bit/nibble order.
    Be interesting to see if 2-bit color comes out right...

    I guess this doesn't need immediate fixing, since it can be rectified with the added code for now...

    Rayman, to get this resolved most efficiently, could you tell me what board you are using? I don't want to make files for every board until I know we've got it fixed. Thanks.
  • cgraceycgracey Posts: 14,133
    potatohead wrote: »
    Yes. That's exactly what are seeing.

    If the fix is in, my 8x8 driver should deliver mirror image characters, and the font reverse routine at the beginning can be commented out.

    Or Rayman's 2 color bitmap won't need whatever REV instruction it's got to sort the image out.


    Potatohead, what board are you using? I recall a DE2-115.
  • RaymanRayman Posts: 13,994
    I've got all the boards, but P123-A7 is what I'm using right now...
  • RaymanRayman Posts: 13,994
    edited 2015-11-19 23:09
    "cgracey wrote: »
    Rayman, change the XCONT that initiates the hsync pulse to XZERO. That will cause each line to be output with each pixel having a constant NCO value (i.e. pixel 100 will always have the same NCO value and, therefore, the same time offset on the scan line. That should take care of the shimmer.

    You're right! That fixed it. WVGA mode (852x480) is rock solid now.


  • cgraceycgracey Posts: 14,133
    edited 2015-11-19 23:27
    One thing that will be a little peculiar about this bit-order change: 'RFLONG LUT' data will be read from hub as if a stream of bytes, with 1/2/4-bit pixel groups read from the top down in each byte. On the other hand, when you do an 'immediate LUT', pixel groups will be read from the top down in the long.
  • RaymanRayman Posts: 13,994
    edited 2015-11-19 23:28
    I just found that 2bpp isn't a standard Windows BMP mode...

    Guess I'll have to programmatically create a data file...

    I suppose in this case it doesn't really matter which way the bits are shifted, since there's no target media anyway...
  • De2
  • potatoheadpotatohead Posts: 10,255
    edited 2015-11-19 23:52
    Chip, I think that is right. Once the longs are end to end, shouldn't it be a linear stream?

  • cgraceycgracey Posts: 14,133
    edited 2015-11-20 00:03
    potatohead wrote: »
    Chip, I think that is right. Once the longs are end to end, shouldn't it be a linear stream?

    This chip, being a 32-bit machine, should probably treat those 1/2/4/8-bit fields as being parts of a long, not bytes. That would match up with 'immediate LUT', too. It's a bit of a pain when you are outputting, say, 8-pixel 1bpp character slices, and you need to MSB-justify the data before sending it out. That seems wrong. If we maintain low-bits-first for LUT modes, you can do things like RDBYTE+XCONT more efficiently.

    What should we do?
  • RaymanRayman Posts: 13,994
    edited 2015-11-20 00:13
    Does it have to be one way or the other? Can it be a setting?

    I think it's pretty powerful to use 1-bit bitmaps as is, without reformatting. Lets you define a font as a bitmap image...
  • jmgjmg Posts: 15,149
    Rayman wrote: »
    Does it have to be one way or the other? Can it be a setting?

    I think it's pretty powerful to use 1-bit bitmaps as is, without reformatting. Lets you define a font as a bitmap image...
    Yes, being able to easily handle standard image files nicely allows many things.
    Not just fonts, but image backgrounds, 'skins' and even colour blends etc become simple to create & render.

    Re 2bpp - can Photoshop create that ?
    If other formats suggest an ordering, then that one should 'slot into'; the same thinking.


  • cgraceycgracey Posts: 14,133
    Rayman wrote: »
    Does it have to be one way or the other? Can it be a setting?

    I think it's pretty powerful to use 1-bit bitmaps as is, without reformatting. Lets you define a font as a bitmap image...

    Do you mean we treat hub memory as a string of bytes for this purpose, and then read each bit (field) from top to bottom, in each byte? Or should it be top to bottom at the long level? Then there's the fact that sometimes you want to stream out from the bottom bits.

    We could use the unused S/# operand to select bit orders for RFLUT modes. We need to determine what the needed options are.

  • RaymanRayman Posts: 13,994
    For me, I'd just like the 1-bit and 4-bit modes to match with Windows bitmap.
  • cgraceycgracey Posts: 14,133
    For RFLUT modes, where this pixel-order issue arises, I see two different things that need to be made optional:

    1) byte-level endian swap on RFLONG input - this makes data byte-ordered
    2) bitfield-level endian swap - this reorders the bitfields within the bytes

    Thinking about it, I don't think anyone would want one without the other. Maybe these could be made together, as a single option?
  • RaymanRayman Posts: 13,994
    edited 2015-11-20 00:56
    Maybe I don't understand, but I think the byte order is fine w.r.t. Bmp format. It's the nibble order in 4 bit mode and bit order in 1 bit mode that are backwards.
    Also, I think it should be the same with or without lut

    Wait... Maybe I'm not sure about that last part
  • cgraceycgracey Posts: 14,133
    Sorry, I made this more complex than it is.

    We just need to fix the bit order for the 1/2/4-bpp RFLONG LUT modes. I got it. This can all be done when the RFLONG data is loaded into the transfer unit. The rest stays the same.
  • cgraceycgracey Posts: 14,133
    Rayman,

    Try this file on your -A7 board:

    https://drive.google.com/file/d/0B9NbgkdrupkHemFrNlE5UWc0MkU/view?usp=sharing

    When doing the 1/2/4-bpp RFLONG LUT modes, try using #1 for S/# on the XINIT/XCONT/XZERO instructions. #1 will re-order the bitfields. #0 will keep them as they've been.
  • RaymanRayman Posts: 13,994
    edited 2015-11-20 02:25
    Works for 4bpp mode. Just had to change one line of code, source to #1 instead of #0

    Same for 1bpp mode. I don't have a quick way to test 2bpp mode...
  • cgraceycgracey Posts: 14,133
    Rayman wrote: »
    Works for 4bpp mode. Just had to change one line of code, source to #1 instead of #0

    Same for 1bpp mode. I don't have a quick way to test 2bpp mode...

    Okay. So, it works as you'd like it to, but you haven't been able to test the 2bpp mode.
  • cgraceycgracey Posts: 14,133
    Potatohead, I'll make a DE2-115 version for you.
  • cgraceycgracey Posts: 14,133
    Potatohead,

    Here is a DE2-115 file that has the new bitfield reordering:

    https://drive.google.com/file/d/0B9NbgkdrupkHZ240VVhEZ1ltRHM/view?usp=sharing

    It's just two cogs.
Sign In or Register to comment.