brain:
BigDumbDinosaur wrote:
brain wrote:
OK, try to contain your laughter and ridicule, as my Verilog is no doubt horrid. I am open to any suggestions on improvements.
I don't think anyone is going to ridicule anything that involves learning, especially when it comes to an arcane subject like programmable logic. You think your Verilog looks bad, you should have seen some of my early attempts at writing 6502 assembly language.
A bowl of spaghetti looked clear and meaningful in comparison.
I think that BDD's sentiments are right on target.
I have spend a few moments with the code you provided. The following are some observations:
(1) CPLDs, in particular the XC9500/XL/XV families, are not well suited to using them as general storage. Meaning that the resources required to implement multi-bit multiplexers within the CPLD is going to use a lot of the function block (FB) resources. In addition, I try very hard to limit bidirectional access on a data bus to registers within an XC9500XL CPLD. Their internal architectures are just not designed to function in this manner.
In a TQ100 package you should not be pin limited, so one suggestion will be for you to implement an input-only bus for the input data path, and one (or more) output-only buses for the output data path(s). This suggestion may or may not apply in your case. I would prefer, if at all possible, that the data written to the CPLD be shadowed elsewhere so that you do not need to read the contents of the registers. If your system timing is correct, you should not need to verify that the registers are written with the data you computed and stored in some kind of on memory in your 6502 system. (If you need to verify system timing, then expose some bits of your internal registers on unused pins of the CPLD.)
(2) Like you, your project synthesizes rather easily for me in an XC95C144XL. However, it uses all of the FBs. I played around with the fitting parameters that I referred to in an earlier post, and I got your project to fit. I made one change, but I don't think that it had any affect. I changed the equation for your reset_en signal; I converted it into a FF:
Code:
reg reset_en = 0;
always @(negedge clock) reset_en <= (cart_config1_reg_ce & data[7]);
Using all of the default settings for synthesis and fitting, I changed the "Collapsing Input Limit" parameter to 28, and the "Collapsing Pterm Limit" parameter to 5. With these settings, your project fits into an XC9572XL-5TQ100 CPLD.
I've attached the fitted design and the entire project in the attached ZIP file. Consider implementing the recommendations I made above with regard to reading back your internal registers. Either recommendation should provide additional resources beyond the 3 remaining macro cells.
Attachment:
File comment: Updated - Fitted Design
UltiMem.zip [1017.33 KiB]
Downloaded 110 times