I need some help with my very first FPGA board (A1)


#1

Hello guys,
Out of curiosity i bought an TinyFPGA A1 board. I have a lot of questions about it as i’m trying to learn how to use it.
In the description i can see that it hase 256 logic gates. What kind of gates ar this? AND, OR, XOR, etc?
I would like to use some JK toggle flip flops to make a frequency divider and a counter for a 7-segment clock. I already did it with CMOS ICs and i would like to try to combine all the ICs into this FPGA IC. (Hope you understand what i mean). Can i achive this using this board? If yes, how can I have two NOR gates to make and RS FF to begin with? and can I assign any pin on the board as input and output? If i want to connect more togheter do I have to connect the pins? or I can dou it internaly?
Hope that you guys understand what I mean and can help.
Thanks in advance,
Georgian Borca.


#2

Hello,

I’ll try to answer some of your questions.

As far as what kind of gates are in the FPGA, they are 4-bit look-up tables (LUT) that can be programmed to be any kind of digital 4-input gate (or combined to make more complex things). This includes all the basic gates you have mentioned. The FPGA has these LUTs combined into “slices” and typically paired with a flip-flip or two (depending on the exact FPGA).

Googling around, the slices in the Lattice Mach-XO2 (used in TinyFPGA Ax) seem to be like this:

image

As far as making a NOR gate, typically you might do something like this in Verilog:

module nor_gate(a, b, q);
    input  a, b;
    output q;
    assign q = ~(a | b);
endmodule

This will be synthesized into the proper LUT programming and slice configuration to make the NOR operation.

I think your 7-segment “clock” project sounds very doable with this FPGA.

Here is another example of a pretty fun Pong VGA project that can be done with the same small FPGA that is in TinyFPGA-A1: (256LUT):


and the Verilog is here:

Info on adding VGA adapter is here:
https://www.fpga4fun.com/PongGame.html

Take it easy,
Xark


#3

Thank you for your answer. Looks nothing like I have imagined. I thought that I can program it usig some sort of schematic editor and I can connect the logic gates to make “bigger components”.
I do have some experience with C/C++ (Arduino) and C# and this looks somehow very different. The internet lacks tutorials for complete beginers too.
Here is the schematic of what i want to achive using this board. I will take it slowly and try to create the modules i need and than see how can i use them. Thanks again.



#4

Hello,

While some FPGA suites have graphical “schematic entry”, I don’t believe Lattice Diamond does (but it can show the results of synthesis visually as gates and modules). The general consensus is that schematic entry gets very tedious doing all editing graphically, as well as being problematic for complex designs, so it has fallen out of favor as FPGAs have gotten larger.

I think your idea to start small and build small modules (and ideally, test them under simulation) and then use these to build more complex things is a good way to go. It can be hard to wrap your head around “code” that really is describing a hardware design, however once you get used to it, it is very powerful (and fun).

Here is an example of a module to decode a 7-segment digit to help give you some ideas:
https://www.nandland.com/vhdl/modules/binary-to-7-segment.html

There are lots of other examples around. Luke (maker of TinyFPGA) has a tutorial here if you haven’t seen it:

Take it easy,
Xark


#5

Hi,

I’m also pretty new to FPGAs. Just wanted to share what I found as a great resource learning and practicing Verilog and digital logic.

https://hdlbits.01xz.net/wiki/Main_Page

Best regards,
Torbjørn


#6

Right on, useful stuff.

For the specifics of using Lattice Diamond to create, simulate and synthesize an FPGA project, I think this video makes for a pretty good walk-through (different FPGA board, but same MachXO-2 chip, so applies to TinyFPGA Ax boards).

Take it easy,
Xark


#7

Reviewing that video, I will note that I don’t believe you can use the “Reveal” logic analyzer with TinyFPGA Programmer. Reveal is totally not required, but it can be handy if you want to debug a design actually running in the FPGA (vs rolling your own way to examine the internal state of the FPGA with LEDs or GPIO etc.).

However, in case you do want to run Reveal (and standard Diamond Programmer) with TinyFPGA you can, but you will need a JTAG board that Diamond is expecting with an FTDI 2232H. These are fairly inexpensive and tend to be detected automatically by Diamond (no special serial numbers or vendor ID needed):
$17 - https://www.amazon.com/FTDI-Breakout-Board-Dual-Channel/dp/B06XGGGMB7
$27 - https://www.seeedstudio.com/FT2232H-USB-2.0-Hi-Speed-breakout-board-p-737.html
€20 - https://bitwizard.nl/shop/FT2232h-Breakout-Board
(and many more, no doubt cheaper ones)

For the 2232H to XO2 JTAG hookup, this chart is helpful (MM Pin Name is generally the FTDI pin name):
https://mindchasers.com/dev/lattice-mini-module

-Xark

P.S. These boards are also pretty handy for USB <-> TTL serial use and with things like OpenOCD JTAG debugging (and lots of other things).


#8

Do you know if Diamond will work with the similar-but-slimmer FTDI FT232H as well? This kind of thing: https://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_C232HM_MPSSE_CABLE.PDF

I’ve used this with JTAG debugging microcontrollers via OpenOCD, so it would be useful if it worked with Diamond too, especially since I’d prefer to write in VHDL…


#9

Hello,
Yes, I believe Diamond will detect and use this FTDI chip also.

Use:
ADBUS0 TCK
ADBUS1 TDI
ADBUS2 TDO
ADBUS3 TMS

-Xark