✨🌀 Mandelbrot Machine in Alhambra-II (with Icestudio)

36 views
Skip to first unread message

charli va

unread,
Dec 7, 2025, 6:23:06 PM (12 days ago) Dec 7
to fpga-wars-explora...@googlegroups.com
  ENGLISH  BELOW   

Hola a todos! mientras vamos cerrando demos para la shield multimedia os traigo algo que podéis probar. y jugar en vuestras Alhambras (y portarlo a otras tarjetas es muy sencillo, en principio solo reconfigurar pines para la VGA y adaptar el pll).

Se trata del circuito del Mandelbrot Machine que Jesús nos presentó hace unos meses.

Os dejo un pequeño video casero que aunque tiene una calidad terrible espero que sirva para que veáis qué podéis encontraros si lo probáis:



Lo estuve trabajando este verano pero no lo tenía a punto para publicarlo.

La gracia de la adaptación es que no toco ni una línea de código del diseño original de Jesús, de echo parte de la motivación era testear una metodología que ando trabajando de generar periféricos emuladores que abstraigan a diseños complejos del hardware en el que se ejecutan, esto no es algo nuevo, en el mundo de la virtualización se lleva haciendo mucho tiempo pero enfocado a fpgas y a hardware mínimo me parece un concepto a trabajar muy interesante.

En este caso ha cumplido su función, me ha permitido adaptar la funcionalidad de un sistema complejo como el Mandelbrot Machine de Jesús utilizando un hardware con menos recursos (la SIMRETRO cuenta con una memoria SRAM externa) sin necesidad de ajustar nada en el core original.

El resultado no es el mismo, pero es intersante y en el camino he desarrollado módulos interesantes que pueden servir de motivación o inspiración para otras cosas que estéis haciendo.

Entre ellas:
  1. Upscaler gráfico
  2. Downscaler gráfico
  3. Smoother gráfico
  4. Color conversion
  5. Emulador de sram para frameworks gráficos
  6. Emulador de mando NES (utilizamos un joystick típico de los módulos de arduino de dos potenciómetros, barato y fácil de conseguir).
  7. Overlays con transformaciones (la lupa)
La FPGA va literalmente llena, sobran solos unos 100LCs o algo menos.

En este caso he usado Icestudio como "pegamento" como constructor del TOP, pero todos los módulos son verilog, que podéis usar directamente en cualquier otro diseña con o sin icestudio.

Cada módulo va documentado en detalle en el propio fichero.

También tenéis una documentación más extensa en el directorio docs esta disculpadme de momento solo la he hecho en castellano.

Inicialmente utilicé un encoder rotativo y un potenciómetro para la interfaz de usuario, el código base del encoder rotativo me lo cedió Demócrito (muchísimas gracias) pero finlmente he sustituido todo por un joystick básico y los botones de la alhambra, ya que era muy engorroso el manejo, digo esto porque animo a Demócrito a "revivir" so bloque porque es muy interesante y lo usaré para otras cosas que os traeré en breve.

Y por supuesto gracias a Jesús por compartir estas criaturas tan bellas.

Lo dicho espero que lo disfrutéis, un abrazo!

    ENGLISH :     

Hello everyone! While we are finishing the demos for the multimedia shield, I’m bringing you something you can already try and play with on your Alhambras (and porting it to other boards is very easy—basically just reconfigure the VGA pins and adapt the PLL).

This is the circuit of the Mandelbrot Machine that Jesús presented to us a few months ago.

Here’s a small homemade video—despite the terrible quality, I hope it helps you get an idea of what you’ll find if you try it out:

https://www.youtube.com/watch?v=UyXZYZVmXzI

And here the code https://github.com/cavearr/icestudio-mandelbrot-machine

I worked on this over the summer, but it wasn’t quite ready for release until now.

The interesting part of the adaptation is that I didn’t modify a single line of Jesús’ original design. In fact, part of the motivation was to test a methodology I’ve been developing: creating emulator peripherals that abstract complex designs from the hardware they run on. This concept is not new—virtualization has used this approach for a long time—but applied to FPGAs and minimal hardware, I find it a very promising idea.

In this case, it served its purpose: it allowed me to adapt the functionality of a complex system like Jesús’ Mandelbrot Machine to hardware with fewer resources (the SIMRETRO has external SRAM), without needing to alter anything in the original core.

The result is not exactly the same, but it is interesting in its own way, and along the process I developed several modules that might inspire or motivate you in your own projects.

Among them:

  1. Graphic upscaler

  2. Graphic downscaler

  3. Graphic smoother

  4. Color conversion

  5. SRAM emulator for graphics frameworks

  6. NES controller emulator (we use a simple Arduino-style joystick with two potentiometers—cheap and easy to find)

  7. Overlays with transformations (the “magnifier”)

The FPGA is literally full; only about 100 LCs or so remain free.

In this case I used Icestudio as the “glue” to build the TOP, but all modules are written in Verilog, so you can use them directly in any other design, with or without Icestudio.

Each module includes detailed documentation in its own file.

You’ll also find more extensive documentation in the docs directory—sorry, for now it’s only available in Spanish.

Initially I used a rotary encoder and a potentiometer for the user interface. The base code for the encoder was kindly shared by Demócrito (many thanks!), but I eventually replaced everything with a basic joystick and the Alhambra’s buttons because the handling was too cumbersome. I mention this because I encourage Demócrito to “revive” his block—it’s very interesting and I’ll definitely use it for other things I’ll share soon.

And of course, thanks to Jesús for sharing such beautiful creations.

That’s it—hope you enjoy it. A big hug!

Jo mo

unread,
Dec 8, 2025, 3:33:14 PM (11 days ago) Dec 8
to FPGAwars: explorando el lado libre
Ola charli ,

Thanks for this one !
it took me about 3 minutes to adapt it to my colorligth i9 board.

And it took about 5 minutes to icestudio to build it and upload it .

IMG_20251208_210912.jpg

in my case, i have no adc connected so no joystick navigation for now  ;-), but i already happy with the result !

Interestingly, the ressource usage on my board is quite high  16354 LUTS. i did not investigate the reason of thaht !
ressource usage mandelbrot.JPG

In any case, it is very interesting to have a look a this complex design using included verilog file .v, i need to analyse/ understand this .ice file more closely !

Thanks again and have a great evening my friend.

charli va

unread,
Dec 8, 2025, 4:21:46 PM (11 days ago) Dec 8
to fpga-wars-explora...@googlegroups.com
Thanks Joaquim for trying it!! i use this design to do some demos for the new shield. And we could do very simple joystick with buttons, in the colorlight there are  a lot of IO pins to do! :)

In other way if you want , do your PR to the project with the ecp5 version! ;)

The resource usage probably is because nexpnr have a lot of space in the room and  try to maximize the MAXFreq, it could "try" more possible solutions for this spend more time in it anf find a 314.86MHz solution!!!

In the ices40hx4k finish very soon (in my computer around one minute) because there are no resources available, probably fewer possible routing solutions, the maxFreq in ice40hx4k is around 30Mhz.

Thanks again for traying it, i'm very happy to see your "3minute" adaptation this is a big success!!!!

I think you need to do something to navigate because this is very funny and interesting.

Thanks again Jo!

--
Has recibido este mensaje porque estás suscrito al grupo "FPGAwars: explorando el lado libre" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a fpga-wars-explorando-el...@googlegroups.com.
Para ver este debate, visita https://groups.google.com/d/msgid/fpga-wars-explorando-el-lado-libre/eea438b6-ab82-47d4-9096-f2012c7a2bf3n%40googlegroups.com.

charli va

unread,
Dec 8, 2025, 4:25:30 PM (11 days ago) Dec 8
to fpga-wars-explora...@googlegroups.com
I forgot to mention, the photo is a meta-fractal photo, because either I see fractals where there aren't any, or is the handkerchief behind the screen a fractal?

Jo mo

unread,
Dec 9, 2025, 4:51:04 AM (10 days ago) Dec 9
to FPGAwars: explorando el lado libre
Ola Carlos,

Yes, your eye catches right :-). In the background i put a 30 years old fractal poster.
20251209_094639.jpg

Another think which i noticed nice in this big design is the speed of icestudio navigation (moves and zooms) is quite fluent.
Due to the fact that most of the design information is inside the individual verilog files.

Have a nice day.

charli va

unread,
Dec 9, 2025, 9:08:24 AM (10 days ago) Dec 9
to fpga-wars-explora...@googlegroups.com
The current IceStudio has many shortcomings, but knowing its weaknesses allows you to work reasonably well. The basic rules are:

  • Use few editors in your design if they have many lines of code. In the current system, every line of code counts and weighs down the system because the rendering is far from optimal.
  • Use fewer wires and better labels.
  • If you have many editors with code, it's best to separate them into blocks or use them as I have done, which is by including the .v files and only instantiating them within the block (a few lines).

With these rules, you can work reasonably well.

Personally, aside from the speed, I really enjoy working this way. I use my preferred editor, the .v file, in parallel with IceStudio, and I primarily work on the top-level modules in IceStudio. I prefer to handle the interconnection between modules in IceStudio; it helps me think in terms of hardware and spatial awareness. But when it comes to actual programming, there's no comparison to using a good editor.

This methodology works very well. In the new icestudio version, I've integrated a much better editor (Monaco, which is the Visual Studio engine)—you're going to love it! I've also incorporated a ton of new features regarding code import and working with Verilog. I think it's all going to be very useful.

I'm going to prepare a video with what I'm working on for the new version, as I also want to ask for your feedback, and taking advantage of what you've said, I thought it would be a good idea.

I'll send it to you in a few days. 

A big huge!

Reply all
Reply to author
Forward
0 new messages