P2Eval <--> TinyFPGA
Rayman
Posts: 14,643
Trying to learn FPGA again and using the P2 Eval board to help.
Tried using some expensive FPGA boards before, but it's just too complex and became overwhelming and just too much work to figure anything out.
This time, using a very simple board, TinyFPGA.
Mentioning it here because using the P2 Eval board to help.
The P2 Eval provides power and a 16-bit interface for I/O with TinyFPGA
Made some notes on TinyFPGA here: http://www.rayslogic.com/TinyFPGA/TinyFPGA.htm
Notes on this interface are going here: http://www.rayslogic.com/TinyFPGA/TinyFPGA_To_P2Eval.htm
Comments
I'm pretty sure we can also program the MachXO2 chip using the P2, but haven't figured out how yet.
BTW: The goal in mind is to create a 4-bit CPU. Starting with a 4-bit ALU. Was thinking about doing it with ancient IC chips, but this is more interesting (and less work).
Seems we have 16 I/O pins that we can easily use.
So, current plan is to use 8 as inputs and 8 as outputs.
Will make a program in FlexC that takes input via serial port and then shows the output.
Could use for automated testing of future designs.
A simple CPU can be simply done in Verilog. Maybe I can find (and then place here) the code I did for my students at the university several years ago. The resulting 8-bit CPU eats up - if I can remember - about 600 (Edit: 379) LEs of Altera Cyclone 4
and there it is.
Piotr, what is the maximum clock frequency ?
I don't remember now. I did this thing for the student's lecture. (I teached basics of FPGA) - but generally this kind of thing works up to 100..200 MHz in Cyclone IV (DE2-115)
The goal was to show students how to make a CPU and peripherals in FPGA, so I also wrote some peripherals (switch input, LED output, 7-segment output) and address decoder, then I connected all of this using Quartus GUI to show the structure of such a system
This CPU has 8-bit (!) memory address space using FPGA's internal memory and separate, 8-bit I/O address space.
Got a 74181 ALU coded up in Verilog.
Going to use P2 to do some automated testing to see if it's right.
Found some C code for 74181 in an old version of Mame: https://github.com/mamedev/historic-mame/blob/master/src/emu/machine/74181.c
Can compare the output of that with FlexProp C to what the fpga is putting out.
The 74181 is actually fairly complex for such an old chip.
And, getting the Verilog to match took a fair amount of time.
I probably made some mistakes somewhere, so this is going to be a big help.
I've got an old VHDL textbook wherein one chapter is entirely replicating an AM2901 (4-bit ALU) in an FPGA. S.
There is the MiSTer project that implements 80/90ies home computers and game consoles using FPGA. Including 68K processors. See eg https://github.com/MiSTer-devel/Minimig-AGA_MiSTer
The P2 was a big help with testing the 74181 in verilog.
Found several bugs.
My carry out is wrong (always 0) when doing logic functions.
I think this is how it should be, but the actual chip doesn't care about M when outputting the carry...
Also, I think there was a bug in the carry out in that Mame code, that I fixed.
Don't know enough about their code to say for sure, but had to change something to match what I think is correct.
This page is very helpful with that: http://www.righto.com/2017/03/inside-vintage-74181-alu-chip-how-it.html