Maker Pro
Maker Pro

video CPLD?

CoCoMan

Feb 11, 2010
11
Joined
Feb 11, 2010
Messages
11
I am looking at building from scratch a 640 x 480(or at least 240) line video display generator which gets the video data directly out of RAM. I came across this <a href="http://elm-chan.org/works/crtc/report.html">article</a> which mentions something about using a CPLD. BUT I am a complete newbie & a rookie when it comes to dealing with CPLDs, I know very little about them. Can anyone give me a few pointers?
 
Last edited:

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
CPLD is a Complex Programmable Logic Device. You can basically take a CPLD chip and wire it internally to implement a variety of functions. A CPLD basically allows you to connect a lot of gates and registers together without having to actually put down and connect several hundred chips on a board.

CPLDs are programmed in programming languages, the two most common ones being Verilog and VHDL. After programming, you download the compiled program to the CPLD. Most CPLDs have Flash memories, so once programmed, the retain that functionality till erased.

Most of the major CPLD manufacturers as well as dozens of small companies make reference design boards for under $100. These boards have a CPLD and a variety of other things like switches, LEDs, keypads, video DACs, connectors etc. You can buy the board with the features you need and program them to learn working with CPLDs.

All of the major CPLD manufacturers let you download their programming software for free from their website. The down side is that the software is specific to the manufacturer. There are manufacturer independent programming tools available, but they are extremely expensive (10's of thousands of dollars).

FPGA (Field Programmable Gate Array) is the CPLD's big brother. Unless you are looking for very low densities, are extremely cost sensitive or have some other very specific requirements that rule out FPGAs, a FPGA is usually a better choice than a CPLD.

---55p
 

CoCoMan

Feb 11, 2010
11
Joined
Feb 11, 2010
Messages
11
Thanks, that's good info...
In my case, it seems better - why buy when the manufacture's is free! Is the manufacture's software the same thing as the Verilog/VHDL software? Does it include that? (if not, where may the language software be obtained)? I'm just trying to get started. I will do a search for one of those RDBs.

By the way, since I'm looking at an embeded (i'm not sure about the definition of "embeded") video circuit, I need a chip that remembers how to count lines/pixels of a graphics screen properly and **doesn't have to be reprogrammed** every time it looses power- can a FPGA do that?
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
Sorry, I missed responding to this last week.

FPGAs have to be programmed after evert power-up or every reset. There are two ways to do this. The FPGA's "program" is kept in a microprocessor's memory and the code running on the microprocessor downloads it to the FPGA. The other way to do it is to put the program into specialized programming chips which automatically download the program to the FPGA at power up.

The down side to both these approaches is that the FPGA takes a little longer to become available after power is applied.

The manufacturers' free software does include Verilog and VHDL and sometimes even a simple schematic entry program. Its limitations are that it usually does not include in-circuit debugging tools and does not support some of the larger devices, which you most probably will not need to use. The biggest limitation is that if you spend the time to learn Altera's software and decide that you want to explore Xilinx products for your next project, you are looking at learning all new tools.

---55p
 

CoCoMan

Feb 11, 2010
11
Joined
Feb 11, 2010
Messages
11
Yes, okay, so I get the point- I need to make up my mind about which manufact. I will go with. I'm *assuming* this decision will be based on which chip I plan to buy and use.

So let me back up and do a little recap here:::

Before I originally posted, I had read all of the following material.

Here are the Wikipedia articles:
http://en.wikipedia.org/wiki/CPLD
http://en.wikipedia.org/wiki/Field-programmable_gate_array

I also read about video controllers:
http://en.wikipedia.org/wiki/Video_Display_Controller

After a deparate search for a video controller, I got the idea I needed these chips whenever I stumbled across the following article:
http://elm-chan.org/works/crtc/report.html (this is the same one as mentioned above)

This article is the only thing I've found that looks both easy, and is as close to what I really want!
Using a CPLD or FPGA, is it really possible to build a video controller?

Since what we are trying to do here is set up counters, buffers, and gates to count lines and pixels, hsync&vsync, and feed them to three DACs to produce RGB color, these chips seems like they would be perfect for the job.

I still have yet to read about a hardware description language to program them:
Verilog http://en.wikipedia.org/wiki/Verilog
VHDL http://en.wikipedia.org/wiki/VHSIC_Hardware_Description_Language

Please forgive me for relying on the wiki- too much. Considering the amount of reading I have to do, this has got to be a long subject, and I have become an information junkie:)
Googling the term "cpld programmer" brings up all sorts of things to with CPLDs, but I am still bewilderd and intimidated by it all. I really want to master this subject. Other than the above sources, I don't where else to turn to.

As I mentioned, I will probably go with the chip and manufacturer that is mentioned in the pinged article. I think this would be avantagous because that way I will have something that someone else has already done and tested to go by for my first CPLD project.

They use a Xilinx CPLD, XC95108. Oh, it just dawned on me and I just realized that this is part of the 9500 family that is mentioned on their website. Now I have to find a programmer. I'll keep you posted when I find out more... thanks.
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
That is one ancient project. Its dates from prehistoric times, some of it from a different millennium. I do not know if the 9500 family is still supported. Can you buy built boards from the website or will you need to have the boards built from his Gerber files? The code is written in ABEL. I do not know if any of the design tools actually support ABEL any more.

I would strongly suggest that you select a "demo board" or "reference board" for the chip you are using, rather than designing a PCB. The IC manufactures make them, as do dozens of companies. These have the CPLD or FPGA plus some additional hardware and frequently a prototyping area. You may be able to get a board that has the video DACs and the 15 pin VGA connector built in. Go to digikey or Mouser and search for Xilinx and Altera then narrow down to demo boards. Sparkfun is another potential source for demo boards.

As you have already realized, you need to decide which manufacturer you want to use. The two big guys are Xilinx and Altera. For what you are doing, you can use the low end chips from either of them. The availability of an appropriate demo board may end up being the deciding factor.

If you need to learn a programming language also, I would steer you to the book: "FPGA Prototyping By ??? Examples" by Pong P. Chu. There are two versions, one for Verilog and one for VHDL (the ??? in the title). I recall that one of the examples in the books is a video controller. The examples in the book are targeted to run on a Xilinx Spartan-3 FPGA reference board made by Xilinx. Even though you will end up spending the usual $50 to $75 for the book (less if you buy used), that may be the most painless way to learn what you are trying to learn at a relatively low cost. I would also look for other online material by Dr. Chu. He is an effective teacher.

---55p
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
Another name to search for is "Starter Kit" from the various manufacturers. A starter kit usually has the board and the programmer cable. Buying a kit from the manufacturer is generally cheaper because they do not need to make a profit from the kit. They get their money when you buy their chips after learning from the kit.

A 3rd party needs to charge you more for their board so they can make a profit to stay in business. But 3rd party boards are usually more specialized and more compact. You may be able to find a 3rd party board that has the programmable device plus video DAC plus connector. The "smallest" board from Xilinx may have all of that plus a LCD, plus a bank of LEDs, plus a bank of switches, plus a prototyping area, plus a host of IO connectors. All of those things you do not need, but you have to accept if you want the lower cost board.

---55p
 

CoCoMan

Feb 11, 2010
11
Joined
Feb 11, 2010
Messages
11
Buying a ready-made kit is not really such a bad idea. I do not need the Gerber files. I have made a circuit board in the past using toner transfer and this homebrew method really does work, believe it or not. So gerber is useless to me if I'm not going to do a PCB send out, but that is another subject. Is this type of use of gerber what you were refering to? (for making PCBs)

DIY- once I get the programmable chip figured out, I will design my own video circuit and board. But I just need a guide to go on first, something to get me started on CPLDs/FPGAs, and my knowledge off of the ground.

I think the kit is a really good place to start, with video DACs, switches, cable, and everything! I would like to have one that connects to my PC's parallel port. Doesn't the cable do that, or rather, is that the type of cable it is? Just checking, I wonder.

I think my problem is that I just didn't know exactly where to look, or what to search for.

No doubt, I will probably use Xilinx. Also, I will most likely have to modify and/or develop my own code to get exactly what I want, or the features I want, so learning to program is a must (I already know Basic, Pascal, and some Assembly). The book may be of some help.

I don't want to take to long to respond, but I need some time to search all these things out. I'm now searching the mfg's website and will be checking various suppiers (i.e., digikey). Thanks for all your responses.
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
I was referring to the Gerber files from the reference design you were mentioning. They guy has the Gerber files on the website and you are welcome to download them and build your own boards from them.

Xilinx is a good choice, as would be Altera. If you have previous experience with Pascal, you should go for learning Verilog. It is quite similar to pascal. I would once again strongly recommend you buy the Chu book and start from there.

If you are thinking of making your own PCBs, you will need to learn how to design boards using a CAD package and have them fabricated professionally. FPGAs are available in BGA or fine pitch packages only. You can not install those packages on a home-spun board. Your home spun board will simply not have the resolution for the fine pitch parts. Low end CPLDs may still be available in PLCC packages but you will be severely limited in how big of a CPLD you can get. You do not want to be in a position where you are stuck with a 104 register CPLD because that is the biggest you can get in a PLCC while you drool over a 10,000 register FPGA that costs half as much.

For designing CPLD and FPGA PCBs you have to worry about SSO (Simultaneously Switching Outputs) and SSR (Simultaneously Switching Registers). Both those conditions generate huge current spikes and the power system has to be designed well to be able to handle that. You can do a CPLD on a 2 layer board, but it requires a lot more expertise than you would possess for your first board. If you do not design the power system properly, one or more flip-flops in the CPLD is going to switch randomly and you will go nuts trying to figure out what is wrong. You will be much better off starting with a 4 layer board, which can not be fabricated at home.

Doing FPGA designs in 2 layers is even harder and requires even more expertise.

I would suggest you look for a reference board or a demo kit that has the features you need. Unless you just have to have some features that no kit offers, I would stay away from doing a PCB unless doing PCBs is your learning goal. There are a number of free or very low cost PCB CAD packages. Eagle is a popular one. There are others as well.

---55p
 

CoCoMan

Feb 11, 2010
11
Joined
Feb 11, 2010
Messages
11
You're right-- I can only spin a board down to 5 mils. Any thing less than that is unpracticle and unpredictable, as pin spacing might become a problem. Even though I already have Eagle, and have actually created a device in it using library editor, I find that is a very time comsuming processes, e.g., if you want a 40-pin card edge, you won't find that in any of the libraries, so I had to create it myself. Sometimes I'm tempted to just simply revert back to using office drawing software, drawing top and bottom sides manually. After all a board really only has two copper layers, top and bottom. (But with CAD, you count all the other types of layers, i.e., pads, silkscreen, keepout, etc.) I have actually done a board this way. That's not to say I'm going to necessarily do one on this one.

You're right- power supply decoupling and spike padding is VERY important. I don't want to go nuts trying to figure out why something is wrong. I would put plenty of decoupling caps near the chip and around the board, and watch closely my timing delays.

I have no idea as to the number of gates that will be needed on-chip in order to accomplish this project. Should I worry about buying an FPGA that is too big? Furthermore, a CPLD remembers its code when a FPGA does not. Of course, I could still program it from the processor.

Here are just some of the boards I've been looking at:
http://www.xilinx.com/products/devkits/DO-CPLD-DK-G.htm
http://www.xilinx.com/products/devkits/ADS-XLX-SP3-DEV2000.htm
http://www.em.avnet.com/evk/home/0,...26LID%3D32232%26BID%3DDF2%26CTP%3DEVK,00.html
http://www.jkmicro.com/products/logicflex.html
http://parts.digikey.com/1/parts/404059-kit-design-cpld-w-batt-holder-do-cpld-dk-g.html

I know you stongly recomend buying an experimentation board, but I haven't gotten barely into this thing far enough to even make a decision. You're definitely way ahead of me. If I wasn't interested in a development board, I wouldn't have searched for it. But I am -trust me.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Should I worry about buying an FPGA that is too big?

No. The major worry is buying one that is too small.

For prototyping you may as well use the largest you think you'll need -- plus some. The difference in cost between a smaller and a larger FPGA is small compared with your time if you have to try to shoehorn something in.

Later, if it goes into production it would be better to pick the size that best fits, and if you went into larger scale production it would warrant spending additional effort to make iit work in smaller (cheaper) FPGAs.
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
Steve is right, you should always err on the side of buying more CPLD/FPGA than you need. The only exception is if you are hard pressed for space and the only devices available in smaller packages are smaller devices. The other exception is if you are REALLY REALLY hurting for power. You will incur a SLIGHT power penalty of the unused gates.

Just as a data point. Most major companies have design guidelines that indicate that Rev 1 of the CPLD/FPGA code should not occupy more than x% of the device. The number x is usually in the 50% to 65% range. In other words, experience has taught big companies to keep 50% of the device blank for the "Oh sh##" moment after the product is fully designed.

Learning any CAD package can be time consuming and frustrating. But you absolutely need to spend the time to learn it. The first board in Eagle is going to take 10 times longer but the 10th board is going to take you 25% of the time and it will save you additional time in debugging because of fewer errors. More importantly, you really do not want to find yourself in the situation where you have to learn a CAD package when you have to do your first design that is far too complicated to do the old way. You also do not want to be doing your first CAD design for your first 4 layer board. Bu the way, "4 layer" means 4 copper layers. No one counts silk-screen and solder masks as "layers" on a board.

If you are thinking of doing a FPGA or CPLD in a 2 layer board, STOP. It is a very challenging design and you are not ready for it. I know that because you did not hit on the right issue. Decoupling caps are important, but they are not the root source of the problem. It is grounding and stray inductance in the power and ground distribution that will lead to ground bounce and brown-outs on your board. Those are very hard to deal with on a 2 layer board even for an experienced designer. If you were not even aware of them, you are taking a huge risk embarking on a 2 layer CPLD/FPGA PCB design.

You are right that CPLD remembers the design while the FPGA has to be downloaded after power-up. But as I had mentioned earlier, you can program your FPGA design into a specialized chip that will remember the design and download it to the FPGA every time power is applied. So, for what you are doing, there is no real difference between the two in this area. FPGAs are usually cheaper, uses less power, have significantly more gates but are usually available only in very fine pitch packages.

And yes, I am faaaaaaaaaar ahead of you in this. I have done plenty of FPGA and CPLD designs professionally, includine boards with FPGAs that are more than several thousand times bigger than the 95108 you were looking at.

Take your time researching and post when you have more questions.

---55p
 
Last edited:

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
#1. This seems to be the same as #5. This may have been the previous version.

#2. This has everything that you need built in, including the video DAC and the DB15 connector. The down side is that it is a FPGA and you seem to be leaning towards a CPLD. This is also available from Digikey.

#3. This is the Avnet portal for all their development boards. Is there one specific board you were looking at?

#4. This is not a FPGA board. I am not sure what is is doing here.

#5. This will work for you if you want to go with a CPLD. You will have to do a board to add a video DAC and a DB15 connector to one of the connectors on the board. Or you will have to hand build the circuit on the prototyping area.

---55p
 

CoCoMan

Feb 11, 2010
11
Joined
Feb 11, 2010
Messages
11
Bu the way, "4 layer" means 4 copper layers. No one counts silk-screen and solder masks as "layers" on a board.

All the blank copper clad laminates like I see here only have two physical sides at the most, top and bottom. Will you show me a blank laminate that has 4 physical layers of copper?
http://www.circuitspecialists.com/prod.itml/icOid/8178

If you are thinking of doing a FPGA or CPLD in a 2 layer board, STOP. It is a very challenging design and you are not ready for it.
Are you refering to a single sided or a double sided board?

I know that because you did not hit on the right issue. Decoupling caps are important, but they are not the root source of the problem. It is grounding and stray inductance in the power and ground distribution that will lead to ground bounce and brown-outs on your board.

I would not want to do a single sided board, anyway. Double-sided with a ground plane on both sides is almost certainly going to absorb unwanted induction better than a single-sided board.
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
A 4 layer board is not something you can do at home. It is made by etching a 2 layer core, laminating fiberglass pre-preg on either side, laminating copper foil, etching the outer foil, drilling the holes then electroplating to plate the insides of the holes, which also plates up the outer layers. It is built by PCB manufacturing companies, working from Gerber and drill data from your CAD package.

In order to minimize inductance in the ground and power traces, you need two planes, one for copper and one for ground. On a 4 layer board, these are typically the two internal planes with signals on the top and bottom layers. If you try and do a FPGA/CPLD board on a 2 layer board, you will at best achieve marginal power delivery with no space left for signal traces to/from the FPGA/CPLD. You can get away with it if you have a REALLY GOOD understanding of power distribution and stray inductance issues. Just adding additional bypass caps is not going to help unless you can back them up with good power delivery.

This is not an area for bravado. The cost of bravado is an unreliable design that is virtually impossible to debug. A typical example of a ground bounce induced fault may be a counter that reaches FF (hex) then instead of going to 00 sometimes goes to 04 and sometimes to 02. Another very common failure mode is that when your counter goes from FF to 00 some other completely unrelated register that is not supposed to be changing, sometimes changes state. Try debugging your code as your hardware does that. Those are the type of problems you will see if the power distribution is not properly designed.

---55p
 

CoCoMan

Feb 11, 2010
11
Joined
Feb 11, 2010
Messages
11
Ah ha! I think we're on the same page now, and I understand you correctly-- A 4 layer board is something somewhat like a "sandwich" wherein the "meat" (the inner layers) are often the ground plane, and the outside layers (top&bottom) are mostly circuit traces. So it actually has 2 sheets of fiberglass laminated together with copper in between - right?

I have actually thought of that idea before, but did not know if it really existed. Oh well, I do now. It's more than just double-sided. Now I can see why this would offer great advantages over a traditional board in grounding --because the ground plane runs all the way through the middle of it- right? Any stray inductance will be immediately absorbed into ground. Okay, so if my analogy is correct, we're on the same page.

It is the vias that connect all this together. This type of design is of course, impossible to do at home - I agree.
 
Top