Create a CPLD program using ABEL#
The main goal of this section is to describe the necessary steps for creating a simple program for the CPLDs on the UltraZohm. All signals from the FPGA to the Digital Adapter cards have to pass through the CPLDs.
Everything is programmed inside the .abl file. Here we can set which ports are inputs or outputs and use logic combinations to create the desired behavior.
Step-by-step#
Install the ispLEVER Classic software from Lattice and clone the CPLD repository, see Install Lattice Toolchain (CPLD) for details.
Create a new branch in the repository, e.g.
feature/project_name
.Inside the CPLD repository, create a copy of an existing project folder, e.g.
optical_14tx_4rx
.Rename the folder to your project name, try to use a meaningful name.
Delete all html and jed files from your project folder. Only
top_level.abl
andoptical_14tx_4rx.syn
should be left.Rename the project file to match your project folder name:
uz_cpld_project_name.syn
.Open the top_level.abl file. In the beginning, all pins are defined and assigned to a physical pin on the CPLD.
fpga_00
..fpga_29
pins are connected to the FPGA/Zynq UltraScale+
d_00
..d_29
pins are connected to the digital adapterThe numbering is zero-based and equivalent to the one in Vivado and in the Altium schematics of the Carrier Board and the Digital Adapter Cards. Do not change this part. It is the same in all projects.
" PIN ASSIGNMENTS " FPGA pins fpga_00 pin 3; ... fpga_29 pin 98; " Digital Adapter pins d_00 pin 50; ... d_29 pin 70;
At the end of the file, there is the section that defines the logic. In the simplest case, this is just an assignment, in the example below
fpga_00
is an input and assigned to the outputd_00
, and vice-versa for pinsd_29
andfpga_29
.EQUATIONS d_00 = fpga_00; fpga_29 = d_29;
Is it also possible to create combinational logic of multiple inputs. The word
node
is an ABEL keyword and creates a signal. This can simplify the logic. The compiler will usually resolve those signals to a combination of inputs only. In the example below, the output is enabled, iffpga_26
andfpga_27
are 0, whilefpga_28
andfpga_29
are 1.enable_signal node; EQUATIONS enable_signal = !fpga_26 & !fpga_27 & fpga_28 & fpga_29; d_11 = fpga_11 & enable_signal;
Use the following logic to create an interlocking functionality, e.g. for the upper and lower switch of a half-bridge. In this case, the output
d_00
is high whenfpga_00 = 1
andfpga_01 = 0
d_00
is low in all other cases, e.g. iffpga_00 = 1
andfpga_00 = 1
EQUATIONS d_00 = fpga_00 & !fpga_01; d_01 = fpga_01 & !fpga_00;
Now, open the project file
uz_cpld_project_name.syn
with ispLEVER Classic and double-click on JEDEC File to create the bitstream for the CPLD.ispLEVER will prompt you asking which constraints to use. Simply press
Import
to import them from thetop_level.abl
file.After successful compilation, it should look like this.
The folder is quite cluttered now, but we only track the highlighted files in git, i.e.
The file
uz_cpld_project_name.html
is the documentation of the crated CPLD program and contains a summary of all settings, e.g. which pin in an input or an output.The report also includes the resulting equations under the tap PostFit_Equations. As mentioned above, the
enable_signal
was resolved into a combination of input pins.If the report matches the expected outcome, the job in ispLEVER is done. You can program the CPLD as described in Programming the CPLD.
After testing it on the UltraZohm, commit your new or modified project to the git repository and open a pull-request.