Shop OBEX P1 Docs P2 Docs Learn Events
Sx / cpld — Parallax Forums

Sx / cpld

BebopALotBebopALot Posts: 79
edited 2006-03-02 17:43 in General Discussion
Folks, can the math coprocessor handle SX speeds of 50MHz or greater or is this a situation where a CPLD may be desirable?

Sincerely,

BBAL

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-28 04:02
    CPLDs aren't going to provide you what you want without alot of headache. Most math coprocessors you buy are serial, so its not going to be 50MHz. Although you could create a math coprocessor on another SX, and have it perform the math.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • BebopALotBebopALot Posts: 79
    edited 2006-02-28 20:00
    I need trig functions, so how would I do this Paul without the math coprocessor?

    Thanks

    BBAL
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-02-28 20:09
    You can use the FPU but what Paul is saying is that serial data isn't going to travel at 50 MHz.· Your data transfer rate will be determined by the baud rate, unless using SPI.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-28 21:12
    Well, You just arn't going to get a true 50Mhz response no matter what you do (not even the old coprocessors for x86 operated at that bus speed). Like I said you can use another SX which contains data tables, if you are working with 8 bits, you would send the argument from the Main SX on a open collector bus, set the function to be performed. The SX acting as a coprocessor takes the function and argument, and looks up the result in a data table and places the result on the same bus (hence the need for the bus to be open collector).

    But all this takes time, actually, now that I think about it here is a good method for on the fly trig functions:

    Find a Parallel EEPROM, EPROM or Flash memory. Then write a program to fill it with the nessesary tables for each of your functions, if your argument is 8 bits, you would store tables of 256 entries. Use additional address pins of the memory to specify different tables, say you want sin, cos, tan and atan, then that would take two extra pins (so far for a total of 10), then you need an additional 8 to read the answer back in (up to 22 now). Now you can use latches to reduce the pin count required, but this will introduce additional delays.

    But no matter how you slice it you aren't going to have a system that provides an answer 20nS after you supply it with the argument.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-28 21:19
    To give you an idea of what Paul is suggesting I've attached a program that mimics the BASIC Stamp 2 SIN and COS functions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-28 21:35
    Thanks Jon, concrete examples always help.

    <edit> Heck, Jon's code doesn't take much space, you might be able to squeeze it into your primary SX, this would speed up the computation </edit>

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 2/28/2006 9:39:51 PM GMT
  • BebopALotBebopALot Posts: 79
    edited 2006-03-01 20:27
    Thanks Paul and John. Now can you point me to resource that would guide me in combining an SX circuit wit an EEPROM, EPROM or flash memory for 12 bit numbers and how to bus it all around. What you are saying sounds like a solution worth investigating but I need to understand how to build it. What role does the FPU play in the trig functions becuase it sounds like you can do it with or without it when adding the EEPROM, EPROM or flash memory by how Paul described it.

    Sounds like cool stuff. Any of you guys written a guide or book on it?

    In the mean time I'll check out the code.


    BBAL
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-01 20:56
    You might want to save yourself some development trouble and look into the uFPU -- it can behave like an I2C device (or SPI device) and I believe Cam, the developer, has already created some SX/B projects with it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • BebopALotBebopALot Posts: 79
    edited 2006-03-02 04:11
    I agree. I was looking at the documentation for it and its all SX-B. Can it not be written in assembly? I know assembly not much Sx-B. Also i think its processor speed tops out at about 4MHz, I think. Which should be...okay.

    BBAL
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-02 17:43
    Since you're comfortable with assembly it should be no problem -- SX/B is easy to isn't hiding anything, you can always look at it's output and lift/optimize routines as you need.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.