This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
Add a tool to program Cyclone V FPGA on de10nano board from userspace #720
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It adds a new tool to program Cyclone V FPGA found on de10 nano board.
From the command line, in Linux user space, this tool accepts an
.rbf
file and program the FPGA.This tool has the same effect than rebooting the board.
Motivation and Context
Useful for debugging and testing.
Description
Is a new tool, nothing else was modified.
A binary is provided for easy use.
The procedure for configuring the FPGA is described in the Cyclone V configuration manual:
Set the cdratio and cfgwdth bits of the ctrl register in the FPGA manager registers (fpgamgrregs) to
match the characteristics of the configuration image. These settings are dependant on the MSEL pinsinput.
Set the nce bit of the ctrl register to 0 to enable HPS configuration.
Set the en bit of the ctrl registerto 1 to give the FPGA manager control of the configuration inputsignals.
Set the nconfigpull bit of the ctrl registerto 1 to pull down the nCONFIG pin and put the FPGA portion of the device into the reset phase.
Poll the mode bit of the stat register and wait until the FPGA enters the reset phase.
Set the nconfigpull bit of the ctrl register to 0 to release the FPGA from reset.
Read the mode bit of the stat register and wait until the FPGA enters the configuration phase.
Clear the interrupt bit of nSTATUS (ns) in the gpio interrupt register (fpgamgrregs.mon.gpio_porta_eoi).
Set the axicfgen bit of the ctrl register to 1 to enable sending configuration data to the FPGA.
Write the configuration image to the configuration data register (data) in the FPGA manager module configuration data registers (fpgamgrdata). You can also choose to use a DMA controller to transfer the configuration image from a peripheral device to the FPGA manager.
Use the fpgamgrregs.mon.gpio_ext_porta registers to monitor the CONF_DONE (cd) and nSTATUS (ns) bits.
Set the axicfgen bit of the ctrl register to 0 to disable configuration data on AXI slave.
Clear any previous DONE status bywriting a 1 to the dcntdone bit of the DCLK status register(dclkstat) to clear the completed status flag.
Send the DCLKs required by the FPGA to enter the initialization phase.
Poll the dcntdone bit of the DCLK status register (dclkstat) until it changes to 1, which indicates that all the DCLKs have been sent.
Write a 1 to the dcntdone bit of the DCLK status register to clear the completed status flag.
Read the mode bit of the stat register to wait for the FPGA to enter user mode.
Set the en bit of the ctrl register to 0 to allow the external pins to drive the configuration input signals.
How has this been tested?
It is specific low level code for de10nano board. It has the single functionality of programming the FPGA chip and nothing else.
Types of changes
Checklist: