Pac-man clone on TinyFPGA BX


#1

Hello everyone!

This is my first post and I wanted to share my first project for the TinyFPGA-BX.
My knowledge in Verilog is basic, so I usually use the “icestudio” program.

I like to use a simple VGA interface as an output device and now I am creating games without synthesizing a microprocessor, directly with logic circuits.

So I did the “Pong” for the TinyFPG-B2 and now I want to try it with Pac-Man.

For now I am doing tests, but if you are interested you can follow the progress in my github account.

I hope I have time to finish it soon and keep moving forward.

Regards and excuse my “google-translate-english”. :sweat_smile:


#2

Awesome! Do you have any pictures to post here?


#3

Yes, I have photos and videos posted on Twitter.
I imagine you’ve seen them. :grinning:
In the github project I have photos, but explained in Spanish.

Some of them are these…
This is a scheme of the basic idea:

A block that represents a map in BRAM memory with each of the graphics (40x30 tiles map, 8 bits per tile) and each tile is a graphic of 16x16 pixels in a ROM (BRAM like only-read).

This block of the map is continuously represented on the VGA monitor in 640x480@72Hz format, that is, using the core PLL to obtain 31.5Mhz from the 16Mhz of the TinyFPGA-BX.

Each object with dynamics in the game (pac-man, blinky, inky …) is represented by its own block and is updated in the game map according to its environment.

Pac-man also has a control input, whose codes are generated from a console on the PC through a simple UART.

Here is a picture of the necessary connections: VGA output (5 outputs) and UART input (1 input and 1 output, RX and TX).

And here the main scheme in “icestudio”, where the whole game is encapsulated in a single block.

And this is the result in a VGA monitor

I am currently testing a map editor and a basic player operation. If you need more photos or someone is encouraged by the project and wants to solve doubts … ask me. :grin:

I do not have much more time for the project than a few hours lost per week, but I think it is an interesting and colorful project with which you can learn a lot.
So … Let’s go for the pac-man! :smile:


#4

La jugabilidad necesita un poco de mejora.


#5

Great!! It’s working on Toshiba! hahahahahahaha
Thank you for your test! :smiley:

Have you been able to connect the UART with the PC?
The j, k, l, i keys from a console at 115220 baud move the pac-man. :slight_smile:
But you’re right, it still takes a lot of work so you can play. :sweat_smile:

But thank you, thank you very much… :wink:


#6

Yes, I found out what keys and baud rate to use, although reading the verilog is hard with all the generated variable and module names.


#7

I assume that the circuitry required is just a few resistors like described here? https://www.fpga4fun.com/PongGame.html. If so, I might give it a go too.

I also found it a bit difficult to trace through the generated code to figure out how the VGA port was supposed to be wired, but just now I’ve realised that the pins used are actually shown in the diagram above which makes things a bit easier! :slight_smile:


#8

Yes, I used the same set-up:

Vsync = PIN 13
Hsync = PIN 12
Red = PIN 11
Green = PIN 10
Blue = PIN 9

TX for UART: PIN 22

And I used 330 ohm resistors.


#9

It is easier to see the keys and baud rate when I load the screen-pacman file in icestudio.

What version of ice-studio are you using? I used the one from Luke’s fork which has support for the BX, but when I loaded your project it said it was for the B2, and asked me if I wanted to convert it.


#10

I got it working here too :slight_smile: although my Samsung TV only seemed to hold lock for 5-10 seconds at a time… It could well be my wiring - I’ll look into it tomorrow.

I chose to put small (50ohm) resistors in-line with the sync lines as some of the diagrams online did this - I’ll try removing them tomorrow and see if that helps…

Thanks for the links to your code, and for the work you’ve put into this so far - I’m keen to see how it progresses! :).

Again, I’m blown away by what these tiny little things can do! :slight_smile:


#11

Yes, it is a drawback of the export in Verilog of icestudio. It does not save the original names of the variables. :confused:


#12

Now it is a version of my own that I modified. It’s a mix of Luke’s fork version with BX support (you must choose the correct branch) and the “apio” version 0.3.4b that supports tinyFPGA-BX without problem. (I think the same or similar one that you use).


But the modified version with which I exported in Verilog for GitHub was older, it was a version for B2, that’s why it asks you to convert. :roll_eyes:


#13

Great!!
No, no, noooo… thanks to you for trying it! :slight_smile:
I can not devote much time these days to the project, so I decided to upload it although it was not finished, in case someone liked it and wanted to take advantage of the work done …

And I am glad that you like it and that you have been able to start it with so little information from me.
You are the best! :slight_smile:
Come on pac-man! :smile:


#14

thats an awsome project , well done!