Thursday 5 October 2017

vhdl - Lattice FPGA - declare pin


I am learning VHDL and I am using the Lattice boards. I want to know how to declare a GPIO. I found the following block of code in the diamond software folder example. It is ".lpf" file and I guess it is the place where the pin are declare. Can anyone explain simply what the lines mean:


BLOCK RESETPATHS ;
BLOCK ASYNCPATHS ;

BLOCK JTAGPATHS ;
IOBUF ALLPORTS IO_TYPE=LVCMOS33 ;
LOCATE COMP "seg_1" SITE "V6" ;
LOCATE COMP "seg_2" SITE "U7" ;
LOCATE COMP "seg_3" SITE "Y6" ;
LOCATE COMP "seg_4" SITE "AA6" ;
LOCATE COMP "seg_5" SITE "U8" ;
LOCATE COMP "seg_6" SITE "T8" ;
LOCATE COMP "seg_7" SITE "AA5" ;
LOCATE COMP "seg_8" SITE "AB4" ;

LOCATE COMP "clk" SITE "L5" ;
IOBUF PORT "seg_1" IO_TYPE=LVCMOS33 TERMINATEVTT=OFF ;
LOCATE COMP "reset" SITE "J7" ;
IOBUF PORT "reset" IO_TYPE=LVCMOS33 ;
LOCATE COMP "direction" SITE "J6" ;
LOCATE COMP "LOCK" SITE "W5" ;
LOCATE COMP "seg_9" SITE "Y20" ;
LOCATE COMP "seg_10" SITE "AA21" ;
LOCATE COMP "seg_11" SITE "U18" ;
LOCATE COMP "seg_12" SITE "U19" ;

LOCATE COMP "seg_13" SITE "W19" ;
LOCATE COMP "seg_14" SITE "V19" ;
LOCATE COMP "seg_15" SITE "AB20" ;
LOCATE COMP "seg_16" SITE "AA20" ;

Correct me if I am wrong, so The first 3 lines block the user to use Pins that are used in JTAG & Reset?


A line like this:


LOCATE COMP "seg_16" SITE "AA20" ;

mean to the synthetizer that the variable seg_16 from the VHDL files is linked to the "real" pin of the board.



Finaly, I got no idea what the IOBUF keyword mean. So Did I get something right or I am plain wrong?



Answer



The *.lpf file does indeed describe the pinout of the FPGA, however before explaining the lines, you should know that there is an easier way to assign them using the Lattice Diamond design software and there are some great tutorials out there showing how to do this, I've just found this one: https://youtu.be/SmdEP_ZsBgM


He starts assigning pins at about 17:15 but it's worth watching the whole thing so you can see the process from start to finish.


To give you an idea of what the lines in the lpf file mean here are a few examples:


IOBUF ALLPORTS IO_TYPE=LVCMOS33 ; = Set all ports to use the 3V3 Low Voltage CMOS logic standard.


LOCATE COMP "seg_1" SITE "V6" ; = Assign the port named "seg_1" to pin V6.


Hope this helps,


Gipsy


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...