MyHDL Python programming option for FPGA

MyHDL is a Python module that brings FPGA programming into the Python environment. [Christopher Felton] tipped us off about a simple tutorial he just finished that gives an overview of how the module is used.

You may remember hearing about PyCPU a couple days ago which can run very simple Python code on a FPGA. There was a healthy discussion in the comments section comparing PyCPU and MyHDL. Although they may seem similar at first, the two are quite different. PyCPU creates a processor on the FPGA chip which can execute a small range of Python code. MyHDL actually implements Hardware Description Language in the Python environment. Once you’re used HDL to model your hardware choices in a Python script, it is converted to VHDL then fed to the toolchain and pushed to the chip like normal.

This is not an absolute beginner’s experience. But if you’re well-versed in Python it makes the jump to HDL a lot easier because you’ll be working with syntax that is already familiar to you.

Programming FPGAs with Python

If you’ve ever wanted to jump into the world of FPGAs but don’t want to learn yet another language, you can now program an FPGA with Python. PyCPU converts very, very simple Python code into either VHDL or Verilog. From this, a hardware description can be uploaded to an FPGA.

The portion of the Python language supported by PyCPU is extremely minimal, with only ints being the only built-in data type supported. Of course ifs and whiles are still included along with all the assignments and operators. A new addition is a way to get digital IO access with Python, and obvious requirement if you’re going to be programming Silicon.

PyCPU surely won’t replace VHDL or Verilog anytime soon, but if you’re looking to get into FPGAs and the ‘telling a chip what to be’ paradigm it offers, it’s certainly a tool worth looking into.

Hats off to [hardsoftlucid] for sending this in. Our wonderful (we mean that, really) noticed a few mistakes when this was first posted. Those mistakes have been corrected.

Decoding, then cloning an IR helicopter toy’s control signals

[Mike Field] got his hands on this Syma S107 helicopter with the intention of hacking it. After playing around with it for a while he set out to build his own infrared controller for the toy. It seems there is some protocol information about it published in various forum posts, but he decided it would be more fun to figure it out for himself.

He started off trying to capture the IR signals using Adafruit’s tutorial which has come in handy on a number of other projects. He could get his television remote to register, but not the toy’s controller. This didn’t stop fun, instead he tore open the controller and grabbed a logic sniffer to see what’s being pushed to the IR LEDs. The signals are a bit curious. It seems two different packets are sent with each command which [Mike] thinks is for use with two different models of the toy. In addition to that the frames are not synchronized. But a bit of 10 MHz sampling helped him to figure everything out, and he believes he’s got a more accurate version of the protocol than had previously been discovered. To prove it he developed an FPGA-based controller using VHDL which he shows off in the clip after the break.

[Read more...]

CRT vector graphics arcade game built from an FPGA board

[Sprite_TM] wanted to challenge his VHDL skills, and there’s no more satisfying way of doing this than making something that will be playable when you’re done. He decided to try his hand at creating a vector-based CRT arcade. The distinction here is that vector-based games take control of the magnetic ring that guides the electron path toward the screen. This technique allows point-to-point graphic generation rather than the pixel-based scanning that CRT televisions use.

He had a small color CRT on hand and decided to grab a VHDL version of asteroids from the Internet to see if he could get it to work. But upon further inspection of the source he found that it had a chunk of code which rasterized the vectors for use with a scanning monitor. After removing that chunk, and giving it a spin he had enough confidence that he knew what he was doing to start implementing his own game. The choice of what title really came down to the hardware the original arcade cabinets used. He was not interested in implementing a soft-process for the math chips used in games like Star Wars and Tempest. In the end he got a version of Black Widow up and running, and even built a miniature cabinet for the thing. Check out some of the gameplay in the clip after the break.

[Read more...]

Get ready to play some wicked air harp

Who needs a tactile interface when you can wave your hands in the air to make music? Air String makes that possible and surprisingly it does so without the use of a Kinect sensor.

In the image above, you can see that two green marker caps are used as plectra to draw music out of the non-existent strings. Judiciously perched atop that Analysis and Design of Digital Systems with VHDL textbook is a camcorder recording an image of the player. This signal is processed by an FPGA (hence the textbook) in real-time, and shown on the monitor seen to the right. A set of guides are overlaid on the image, so the player knows where to pluck to get the notes she is expecting.

The program is designed to pick up on bright green colors as the inputs. It works like a charm as you can see in the video after the break. The team of Cornell students responsible for the project also mention a few possible improvements like adding a distance sensor (ultrasonic rangefinder?) so that depth can be used for the dynamics of the sound.

[Read more...]

Robot follows the rules of the road

This is a fantastic high school project. [Shmendrik213] built and robot a programmed it to follow common traffic rules. The robot drives itself with a DC motor, using one servo for steering and another to pan a webcam back and forth. The netbook that comes along for the ride is running a VB.NET program that can detect an upcoming intersection, read the street sign, and react based on other cars currently at the intersection.

The hardware is running on an Altera processor using firmware programmed in VHDL. We remember building a tissue box holder for one of our high school projects. Looks like the times have changed since then.

AVR8 virtual processor on FPGA

[Jack] wrote in to let us know about a project that creates a virtual microprocessor core based on the ATmega103 by using a Field-Programmable Gate Array. Great, we thought. Here’s another rather esoteric project like the NES on a FPGA, but what’s the motivation behind it? We asked [Jack] and he provided several scenarios where this is quite useful.

Implementing the AVR core allows code already written for the chips to be easily ported to an FPGA without a code rewrite. This way, if your needs outpaced the capabilities of the microcontroller long after the project has started, you can keep the code and move forward from that point with the added capabilities of the gate array. Having the core already implemented, you then only need to work with HDL for the parts of the project the AVR was unable to handle. He also makes the point that having an open source AVR core implementation provides a great tool for people already familiar with AVR to study when learning VHDL.

With products like the Butterfly that this project is based around, or the Maple we’ve seen in the past, programmable logic for the recreational hacker is starting to get a little easier.

Follow

Get every new post delivered to your Inbox.

Join 96,449 other followers