Retro ZX Spectrum Lives A Spartan Existence

FPGAs (like Xilinx’s Spartan series) are great building blocks. They often remind us of the 100-in-1 electronic kits we used to get as kids. Lots of components you can mix and match to make nearly anything. However, like a bare microcontroller, they usually don’t have much in the way of peripheral devices. So the secret sauce is what components you can surround the chip with.

If you are interested in retro computing, you ought to have a look at the ZX-Uno board. It hosts a Spartan 6 FPGA. They are for sale, but the design is open source and all the info is available if you prefer to roll your own or make modifications. You can see a video of the board in action, below (as explained in the video, the color issues are due to the capture card trying to deal with the non-standard sync rate).

Here are the key specifications:

  • FPGA Xilinx Spartan XC6SLX9-2TQG144C
  • Static Memory 512Kb, AS7C34096A-10TIN
  • 50MHz Oscillator
  • Video output (composite)
  • PS/2 keyboard
  • Stereo audio jack
  • EAR jack connector (for reading cassette tapes)
  • Connectors for JTAG and RGB
  • Slot for SD Cards
  • Expansion port with 3 male pin strips
  • Micro-USB power connector
  • PCB Size: 86×56 mm. (Compatible with Raspberry Pi cases)

Continue reading “Retro ZX Spectrum Lives A Spartan Existence”

Custom Zynq/CMOS Camera Unlocks Astrophotography

Around here we love technology for its own sake. But we have to admit, most people are interested in applications–what can the technology do? Those people often have the best projects. After all, there’s only so many blinking LED projects you can look at before you want something more.

[Landingfield] is interested in astrophotography. He was dismayed at the cost of commercial camera sensors suitable for work like this, so he decided he would create his own. Although he started thinking about it a few years ago, he started earnestly in early 2016.

The project uses a Nikon sensor and a Xilinx Zynq CPU/FPGA. The idea is the set up and control the CMOS sensor with the CPU side of the Zynq chip, then receive and process the data from the sensor using the FPGA side before dumping it into memory and letting the CPU take over again. The project stalled for a bit due to a bug in the vendor’s tools. The posts describe the problem which might be handy if you are doing something similar. There’s still work to go, but the device has taken images that should appear on the same blog soon.

Continue reading “Custom Zynq/CMOS Camera Unlocks Astrophotography”

Amstrad On An FPGA

If you are from the United States and of a certain age, it is very likely you owned some form of Commodore computer. Outside the US, that same demographic was likely to own an Amstrad. The Z80-based computers were well known for game playing. [Freemac] implemented a working Amstrad CPC6128 using a Xilinx FPGA on a NEXYS2 demo board.

The wiki posting is a bit long, but it covers how to duplicate the feat, and also gives technical details about the design. It also outlines the development process used ranging from starting with a simple Z80 emulation and moving on to more sophisticated attempts. You can see a video of the device below.

Continue reading “Amstrad On An FPGA”

Gravity Simulations With An FPGA

Gravity can be a difficult thing to simulate effectively on a traditional CPU. The amount of calculation required increases exponentially with the number of particles in the simulation. This is an application perfect for parallel processing.

For their final project in ECE5760 at Cornell, [Mark Eiding] and [Brian Curless] decided to use an FPGA to rapidly process gravitational calculations. This allows them to simulate a thousand particles at up to 10 frames per second. With every particle having an attraction to every other, this works out to an astonishing 1 million inverse-square calculations per frame!

The team used an Altera DE2-115 development board to build the project. General operation is run by a Nios II processor, which handles the VGA display, loads initial conditions and controls memory. The FPGA is used as an accelerator for the gravity calculations, and lends the additional benefit of requiring less memory access operations as it runs all operations in parallel.

This project is a great example of how FPGAs can be used to create serious processing muscle for massively parallel tasks. Check out this great article on sorting with FPGAs that delves deeper into the subject. Video after the break.

Continue reading “Gravity Simulations With An FPGA”

Ask Hackaday: Computing Square Roots On FPGA?

Hackaday reader [nats.fr] wrote in with some code from a project that resizes a video stream on the fly using an FPGA. Doing this right means undoing whatever gamma correction has been applied to the original stream, resizing, and then re-applying the gamma. Making life simpler, [nats.fr] settled on a gamma of two, which means taking a bunch of square roots, which isn’t fast on an FPGA.

[nats]’s algorithm is pretty neat: it uses a first-stage lookup to figure out in which broad range the value lies, and then one step of Hero’s algorithm to refine from there. (We think this is equivalent to saying he does a piecewise linear interpolation, but we’re not 100% sure.) Anyway, it works decently.

Of course, when you start looking into the abyss that is special function calculation, you risk falling in. Wikipedia lists more methods of calculating square roots than we have fingers. One of them, CORDIC, avoids even using multiplication by resorting to clever bitshifts and a lookup table. Our go-to in these type of situations, Chebyshev polynomial approximation, didn’t even make the cut. (Although we suspect it would be a contender in the gamma=1.8 or gamma=2.2 cases, especially if combined with range-reduction in a first stage like [nats.fr] does.)

So what’s the best/fastest approximation for sqrt(x) for 16-bit integers on an FPGA? [nats.fr] is using a Spartan 6, so you can use a multiplier, but division is probably best avoided. What about arbitrary, possibly fractional, roots?

Compiling A $22 Logic Analyzer

On my way to this year’s Hackaday SuperConference I saw an article on EE Times about someone taking the $22 Lattice iCEstick and turning it into a logic analyzer complete with a Python app to display the waveforms. This jumped out as pretty cool to me given that there really isn’t a ton of RAM on the stick, basically none that isn’t contained in the FPGA itself.

[Jenny List] has also written about the this application as created by [Kevin Hubbard] of Black Mesa Labs and [Al Williams] has a great set of posts about using this same $22 evaluation board doing ground up Verilog design using open source tools. Even if you don’t end up using the stick as a logic analyzer over the long haul, it’ll be very easy to find many other projects where you can recompile to invent a new purpose for it.

Continue reading “Compiling A $22 Logic Analyzer”

Icehat on a Raspberry Pi Zero

Give Your RPi A Cool FPGA Hat

Need additional, custom IO for your Raspberry Pi? Adding an FPGA is a logical way to expand your IO, and allow for high speed digital interfaces. [Eric Brombaugh]’s Icehat adds a Lattice iCE5LP4K-SG48 FPGA in a package that fits neatly on top of the Raspberry Pi Zero. It also provides a few LEDs and Digilent compatible PMOD connectors for adding peripherals. The FPGA costs about six bucks, so this is one cheap FPGA board.

The FPGA has one time programmable memory, but can also be programmed over SPI. This allows the host Pi to flash the FGPA with the latest bitstream at boot. Sadly, this particular device is not supported by the open source Icestorm toolchain. Instead, you’ll need Lattice’s iCEcube2 design software. Fortunately, this chip is supported by the free license.

Icehat is an open source hardware design, but also includes a software application for flashing a bitstream to the FPGA from the Pi and an example application to get you started. All the relevant sources can be found on Github, and the PCB is available on OSHPark.

While this isn’t the first pairing of a Raspberry Pi and FPGA we’ve seen, it is quite possibly the smallest, and can be built by hand at a low cost.