Jump to content

Photo

F18A


810 replies to this topic

#501 intvnut ONLINE  

intvnut

    Stargunner

  • 1,026 posts
  • Location:@R6 (top of stack)

Posted Sun Feb 26, 2012 7:22 PM


Another idea... but do as you like, it's just an idea: the F18A could offer a fast RND function, one write address to set the max value and one read address to get a random number between 0 and max. If your max doesn't change, just use the read value.


Yup, I thought about that, and I actually have that feature half implemented. Not sure if it will get finished though.


What about just some free-running LFSRs? The TMS9900 has a MPY instruction, so you can take the LFSR output and multiply it by the size of the range and take the upper bits of the result. That part doesn't need to be in F18A hardware. For additional entropy, you could XOR in whatever's currently on the data bus each cycle.

The update rule for the random number generator could then be as simple as:

    rng = (rng >> 1) ^ data_bus ^ (rng & 1 ? 0x8048 : 0);

(0x8048 is one polynomial I happen to have memorized. There's dozens out there, and all work pretty well.) With that running at the F18A's 100MHz clock rate, it'll be way more random than anything you'd hope to generate on the TMS9900.



#502 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Sun Feb 26, 2012 10:55 PM

What about just some free-running LFSRs?


That's exactly what I was working on! Well, almost. I was not going to have it free running so you could set the seed and a have a reproducible list of pseudo random numbers if you need (good for debugging). Initially I was going to implement a Mersenne Twister (there is a free core available), but I didn't initially realize it requires 5 block RAMs, and I'm down to only 1 spare (the 16K chews up most of them, and the line buffers consume the rest). So, I started looking for a less resource intensive alternative and found the LFSR. I'll see what I can do about getting it worked in.

#503 intvnut ONLINE  

intvnut

    Stargunner

  • 1,026 posts
  • Location:@R6 (top of stack)

Posted Sun Feb 26, 2012 11:08 PM

That's exactly what I was working on! Well, almost. I was not going to have it free running so you could set the seed and a have a reproducible list of pseudo random numbers if you need (good for debugging). Initially I was going to implement a Mersenne Twister (there is a free core available), but I didn't initially realize it requires 5 block RAMs, and I'm down to only 1 spare (the 16K chews up most of them, and the line buffers consume the rest). So, I started looking for a less resource intensive alternative and found the LFSR. I'll see what I can do about getting it worked in.


Ah yes, reproducibility. That makes the random number generator WAAAY more complicated, since you need to know exactly how many times it's been read, and have well controlled ways of getting entropy into it.

In contrast, an actual random number generator wants to get entropy anywhere it can. It's practically the enemy of reproducibility.

If you want to enable a debug mode, why not just have an LSFR that only advances when read and can be reset to a known starting state with a write, and then the free-running thing with data-bus mixing for production purposes? Then it's just two different clocking modes.

The MT is just an LFSR on steroids with a huge delay line, anyway, if you look at what it actually does. :-)

#504 intvnut ONLINE  

intvnut

    Stargunner

  • 1,026 posts
  • Location:@R6 (top of stack)

Posted Mon Feb 27, 2012 9:09 AM

Ah yes, reproducibility. That makes the random number generator WAAAY more complicated, since you need to know exactly how many times it's been read, and have well controlled ways of getting entropy into it.

In contrast, an actual random number generator wants to get entropy anywhere it can. It's practically the enemy of reproducibility.


Or, a different thought: Just have two LSFRs. One that "free-runs" and one that advances when read. To debug your program just switch which one it uses. Switch it back once you're done debugging.

On a related note, CRCs are just LSFRs + an XOR on incoming data. If the one that advances purposefully let you write a byte (which would get XORed with the LSFR value) and then advanced 8 clocks, it would also double as a CRC accelerator.

#505 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Mon Feb 27, 2012 9:40 AM

If I manage to get the feature added in time, it will definitely be LSFR based, probably 32-bit with xnor taps at 32, 22, 2, and 1 based on this paper:

http://www.xilinx.co...tes/xapp052.pdf

See pg. 5.

I will probably have a way to set the initial value, single increment, or free run. I will try to incorporate a divider so you can set a 0..n range for the result. I imagine being able to read 1 to 4 bytes of the result, and when you read the last byte it will single step to the next value, or start free running again (reading the 1st byte would stop the free running).

We'll see, but I still have a few other "base" features to get done, order boards, and put the suckers together.

#506 Tursi OFFLINE  

Tursi

    River Patroller

  • 2,350 posts
  • Location:BUR

Posted Mon Feb 27, 2012 4:58 PM

I think if you are going for a hardware random number generator, that reproducability need not be a design goal. A reproducable random number stream is not expensive to generate in software, but true randomness is very hard. Do existing hardware random number generators have reproducability? I thought they were free-running too.

#507 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Mon Feb 27, 2012 5:03 PM

I'm really not sure, I never looked in to a hardware RNG, or at least I have never worked on a system that had one. Being able to set the seed, or set the RNG as free-running vs. stepped in the easy part. Implementing a range, which requires a hardware divide circuit, is the harder part. I have example HDL for both parts, I just have to get the time to bring them together.

So I'm getting the feeling that this would be a desirable feature?

#508 intvnut ONLINE  

intvnut

    Stargunner

  • 1,026 posts
  • Location:@R6 (top of stack)

Posted Mon Feb 27, 2012 6:28 PM

I'm really not sure, I never looked in to a hardware RNG, or at least I have never worked on a system that had one. Being able to set the seed, or set the RNG as free-running vs. stepped in the easy part. Implementing a range, which requires a hardware divide circuit, is the harder part. I have example HDL for both parts, I just have to get the time to bring them together.

So I'm getting the feeling that this would be a desirable feature?


Would a divide or a multiply be a better choice here? Multiplies tend to distribute any quantization bias a little more evenly. (PM me if you want more details.)

Since the TMS9900 at least has both instructions, do you need either? I guess the Z80 folks will feel left out if you didn't do the scaling for them. ;-)

#509 Lee Stewart OFFLINE  

Lee Stewart

    Stargunner

  • 1,228 posts
  • Location:Maryland

Posted Mon Feb 27, 2012 8:29 PM

We have beaten on RNGs here: http://www.atariage....mber-generator/ and http://www.atariage....ly-rnd-routine/.

You pretty much want an RNG to produce exactly the same sequence from the same seed that runs through the given number range in as chaotic a way as possible and with as few duplications (preferably, none) as possible. This does, indeed, aid in testing because you can pick the seed. After testing, you usually add a step that starts with an unknown seed (usually by means of a function named RANDOMIZE), periodically, or for every call to the RNG to get closest to truly random numbers.

That said, there is a very good discussion on random number generation in Numerical Recipes, 3rd Edition by Press et al.

...lee

#510 retroclouds OFFLINE  

retroclouds

    Stargunner

  • 1,355 posts
  • Location:Germany

Posted Wed Feb 29, 2012 9:24 AM

Hehe, seems the F18a also made some publicity on MSX.org

Did generate quite some comments

http://www.msx.org/n...o-board-f18a-13

#511 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Wed Feb 29, 2012 12:03 PM

Interesting. Thanks for pointing that out. I knew it made their news, but I didn't see the comments before.

#512 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Wed Feb 29, 2012 2:18 PM

Since I'm still undecided how I'm going to format my website with documentation, here is the v1.3 feature list. Some things might change slightly, but this is the bulk of it I think.

Main F18A V1.3 Features

Outputs standard 640x480@60Hz analogue VGA
Direct hardware pin-compatible replacement for the 9918A, 9928, and 9929 VDPs
Software compatible with the 9918A VDP
All four original 9918A graphics modes
80-column text mode
Per-tile color in text modes
Sixty-four programmable color registers with a selection from a palette of 4096 colors
Enhanced color modes for 2, 4, or 8 colors for tiles and sprites
Tile priority over sprites on a per-tile basis
Extra attribute information per tile: flip x, flip y, transparent, and palette select
Support for 30 rows in Graphics Mode I for an NES compatible display size (32x30 tiles)
Enhanced name table configurations to support scrolling
Horizontal and vertical scroll registers
Horizontal scan line interrupt
No per-line sprite limit, so all 32 sprites can be displayed on the same horizontal line
Sprite linking (move multiple sprites by updating a single sprite's coordinates)
Enhanced sprite collision detection information
Sprite size, 8x8 or 16x16, selectable per sprite
Extra attribute information per sprite: flip x, flip y
Address auto-increment selectable between +1 or +32 after a read or write
No CPU to VDP read or write speed limitations (up to 25MHz CPU clock speed)


Original 9918A Features Not Reproduced

External sync
External video input
Composite output
50Hz operation
4K VRAM addressing

Edited by matthew180, Wed Feb 29, 2012 4:08 PM.


#513 moulinaie OFFLINE  

moulinaie

    Moonsweeper

  • 300 posts
  • Location:France, Burgundy

Posted Wed Feb 29, 2012 3:03 PM

This is Christmas !!!!!!
Great job!

Guillaume.

#514 Willsy OFFLINE  

Willsy

    Stargunner

  • 1,701 posts
  • Location:Uzbekistan (no, really!)

Posted Wed Feb 29, 2012 4:09 PM

Wow!

#515 ti99userclub OFFLINE  

ti99userclub

    Dragonstomper

  • 522 posts
  • Location:Italy

Posted Thu Mar 1, 2012 7:52 PM

Hi Matthew !

i done a little article on your F18A on my website ;-)
you like ?

http://www.ti99iuc.i...ooooo-&Itemid=2

there is an automatic translation when you click on the flags ! :D

Edited by ti99userclub, Thu Mar 1, 2012 7:54 PM.


#516 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Thu Mar 1, 2012 9:33 PM

Very nice, thanks for the extra press! The auto-translate is a nice feature, especially since I don't speak Italian. :ponder: I like some of the language too, it is fun to see how some things are described in other languages and how they translate.

#517 ti99userclub OFFLINE  

ti99userclub

    Dragonstomper

  • 522 posts
  • Location:Italy

Posted Fri Mar 2, 2012 2:36 AM

I am Happy you like ;) ....
you know, when i will got the F18A i will write a complete and detailed review as i done for the Sid Master99 ;)

#518 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Mon Mar 5, 2012 3:07 PM

UPDATE:

A week late, I know, I apologize. Since the minimum order to have the F18A manufactured was not met, I have decided I can handle the quantity myself and I will be doing all the assembly. This will slow down the delivery a little, but not too much I hope. Boards and parts have been ordered, and once they come in I will begin fulfilling the F18A orders in the order they were received.

Since the orders are not overwhelming, I'm going to leave the pre-orders active for now. I plan to make a few extra boards which will be on sale after the pre-ordres have been fulfilled, and beyond that I will consider making boards on an as-needed basis. My plan is to make the F18A available to everyone who wants one.

Thank you everyone for your support and patience, but the waiting is almost over! :-)

#519 Cory OFFLINE  

Cory

    Space Invader

  • 31 posts

Posted Tue Mar 6, 2012 2:23 AM

UPDATE:

A week late, I know, I apologize. Since the minimum order to have the F18A manufactured was not met, I have decided I can handle the quantity myself and I will be doing all the assembly. This will slow down the delivery a little, but not too much I hope. Boards and parts have been ordered, and once they come in I will begin fulfilling the F18A orders in the order they were received.

Since the orders are not overwhelming, I'm going to leave the pre-orders active for now. I plan to make a few extra boards which will be on sale after the pre-ordres have been fulfilled, and beyond that I will consider making boards on an as-needed basis. My plan is to make the F18A available to everyone who wants one.

Thank you everyone for your support and patience, but the waiting is almost over! :-)


If you're looking for help, I'm happy to offer my board assembly and soldering skills to the effort.

Edited by Cory, Tue Mar 6, 2012 2:24 AM.


#520 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Wed Mar 7, 2012 9:01 AM

If you're looking for help, I'm happy to offer my board assembly and soldering skills to the effort.


I'll see how it goes first, but I might just take you up on that. Thanks for the offer. By the way, did you ever get your disk controller working?

#521 Cory OFFLINE  

Cory

    Space Invader

  • 31 posts

Posted Sat Mar 10, 2012 2:21 AM

I'll see how it goes first, but I might just take you up on that. Thanks for the offer. By the way, did you ever get your disk controller working?

No, but I did isolate the problem down to a blown buffer. I just never got around to replacing it. The excitement was in the hunt for the problem. I still intend to replace it, but more exciting projects have taken its place.

#522 matthew180 OFFLINE  

matthew180

    Stargunner

  • Topic Starter
  • 1,763 posts
  • Location:Ceresco, Michigan

Posted Fri Mar 16, 2012 6:45 AM

Update:

The boards came in yesterday. Now I'm just waiting on a few parts and I can begin some assembly!

Attached Files



#523 Cory OFFLINE  

Cory

    Space Invader

  • 31 posts

Posted Fri Mar 16, 2012 7:21 PM

I think I see mine. Isn't it the one 2nd from the left? ;)

#524 OLD CS1 OFFLINE  

OLD CS1

    Stargunner

  • 1,041 posts
  • IT Samurai
  • Location:Tallahassee, FL

Posted Fri Mar 16, 2012 10:43 PM

Pretty.

#525 opcode OFFLINE  

opcode

    River Patroller

  • 3,121 posts
  • Bringing new life to your ColecoVision!
  • Location:Franklin, MA

Posted Sat Mar 17, 2012 11:14 AM

I cannot wait to get mine.... :)




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users