Aslak3 wrote:
I found this:
http://www.atmel.com/tools/PROCHIPDESIGNER.aspx which I'm guessing is a VHDL/Verilog compiler but it says you need a "two year license".
I asked ATMEL once for a PROCHIPDESIGNER license (there is an option to get it free) because some designs I made would not compile under WinCUPL. But instead they gave me some support how to change the design so it will work with WinCUPL. So I found out there are many options in WinCUPL so even complex designs will fit. I decided to stay with WinCUPL. Sad thing is that WinCUPL is only poorly documented. PROCHIPDESIGNER would have the advantage to support VHDL/Verilog, but there are some remarks to that, again documentation is very poor and I doubt that it supports all the new development in VHDL design as the software itself is no longer developed.
cbmeeks wrote:
Pardon my ignorance, but this part confuses me. From what I understand, each pin needs to be a part of a macrocell. Meaning if you had 10 pins each running their own logic, that would need 10 macrocells. Even though the logic might be very simple. If you had something like a databus, then 8 pins could be apart of one macrocell.
Is that correct?
If so, where does the 40 signals come in? Are signals the same as pins in this context?
I *really* wished there was a "CPLD for Dummies" book because I sure am a dummy sometimes.
I also wished there would be some Introduction Guide. So here the next chapter in my experience with CPLDs. First a word about the different brands. CPLD are very similar and differ only very little from brand to brand. As long as you stick to the basics in your logic you can use whatever CPLD in a PLCC-44 package. Generally all CPLDs have the following structure, here I'm referring to the 64 MC size (or 72 MC in case of Xilinx ones). Larger CPLDs are similar and mostly are just multiple 64/72 MC CPLDs in one package.
As I have explained in my first post you have user pins. MC are numbered from 1 to 64 and are grouped into logic blocks. Logic Block A consists of MC 1 to 16, Logic Block B consists of MC 17 to 32 and so on. Each of the user pins that is IO capable has a fixed MC associated with it. But only if you use this pin as an output or a bidirectional PIN the MC will be effectively "connected" to this PIN. Macro Cells are the equivalent to the OLMC (Output Logic Macrocell) of GALs, however a typical MC of a CPLD only has 5 product terms (in contrast to 8 to 16 PT of a OLMC in a GAL22V10). As I have already explained we have a total of 36 user pins out of them 4 or input only pins. So half of the macrocells is directly "linked" to a IO pin (which includes the JTAG pins). So in fact in a standard hobby design there are 28 MC that are linked to pins and the rest are "buried" MCs.
A macro cell has 5 product terms, a flip flop and some signal routing features that allows the mapping of the PT to some special functions. Which parts are used depends on your design. When you look at a logic block then you have essentially a GAL with 40 inputs, 16 OLMCs and up to 8 outputs (this is valid for PLCC-44 and TQFP-44, in case of larger packages more outputs per logic block are available but you still have only 64 MCs).
Then you have the signal routing. This is different to GALs. In a CPLD you have a global bus that carries all possible signals. That is all pins (IO and Input only pins), all outputs of MC (regardless if they are buried or if they are one of those with a linked PIN, so this is quite some signals, well over 100). For each Logic Block you can select up to 40 of those signals to be used in the Logic Block. So to speak these 40 signals are a subset of all possible signals. This is called the FAN-IN of a logic block. Each of those 40 signals are then available to all 5 PTs of every MC in a Logic Block. If I say select then this is not really something you have to do. Normally the fitter automatically selects which signals are faned-in. It also performs the mapping of your signals to the PINs if you let him do so (i.e. if your PIN definitions do not specify the PIN number to be used). Something I recommend when you first build your design. Of course once you have done the layout of your board you need to fix the PIN numbers to avoid the shuffling of PINs when you change your design on a life system. For this you need to copy the PIN number findings of the fitter to your design files.
Note that the global input pins like RESET, OUTPUT ENABLE or CLOCK (if used) are available to all MCs and do not count as signals used for FAN-IN. As FAN-IN is one of the most limiting factors in a CPLD you should make use of these features as much as possible.
Now back to the MC and its 5 PTs. You may think this is not much, but when you look at your design, or even take designs you have done using a GAL you will find that only very few outputs require more then 5 PTs. Also there is a nice feature in CPLDs. A MC can borrow the PT of its predecessor MC if this MC is not linked to a PIN or if the predecessor MC is not used. E.g. PIN 6 of the PLCC-44 is linked to MC 11. MC 6,7,8,9 and 10 are buried or cannot be used (MC 8 which is PIN 7 which is TDI of the JTAG interface must not be used) and are all predecessor of MC 11 (that is adjacent MC with decrementing number). So you can borrow up to 40 PTs. But borrowing works only for one logic statement. But again this is hardly a limitation.
Now how are PTs used. Each MC has a PT MUX and each PT can be routed to one of the functions of the MC. A MC provides the following functions you may use.
CLOCK if you need one or more PT for the logic of the clock of a Flip-Flop, else you should use the global CLOCK input
RESET if you need one or more PT for the logic of the clock of a Flip-Flop, else you should use the global RESET input
OUTPUT ENABLE if you need one or more PT for the logic of the tri-state out, else you should use the global OUTOUT ENABLE input
Asynchronous Reset of the Flip Flop
Asyncrhonous Set of the Flip Flop
Normal Logic Function use either for a directly connected output (no FF used) or for the D input of the FF
Note, only the logic function may borrow PT from predecessors.
This is very simplified. There is more, e.g. each MC has a local feedback bus that allows to use combinatorial outputs within the same Logic Block without consuming FAN-IN. This is useful in case you cannot borrow PT from predecessor MCs. But there is a propagation delay penalty to it.
I hope I did not add to the general confusion of CPLDs and rather shed some light to it. Just download WinCUPL and start to convert your GAL designs to WinCUPL and have a look what happens. You could for example first create the JED for a GAL and then remove all PIN numbers and tell WinCUPL it should create the files for a ATF1504AS using the same logic. If course this will be a total overkill but you get a chance to understand what WinCUPL does how MCs work. The best is to start with a complex design made for a GAL22V10 with all features of a GAL22V10 used that are not generally available to smaller GALs to really see what's going on, e.g. a Design that uses CLOCK, OUTPUT ENABLE, RESET and SET features.
Cheers
Peter