This RISC-V CPU Games In Rust From Inside The Game

[Xander Naumenko] has created something truly impressive — a working RISC-V CPU completely contained in a Terraria world. And then for added fun, he wrote the game of pong, playable in real time, from within the game of Terraria. It’s all based on the in-game wiring system, combined with a bit of a hack that uses the faulty lamp mechanic to create a very odd AND gate. In Terraria, the existing logic gates have timing issues that make them a no-go for complicated projects like this one. The faulty lamp is intended to do randomized outputs, by stacking multiple inputs to get a weighted output when a clock signal is applied. The hack is to simply give this device a single input, turning it into a clocked IF gate. Two of them together in series makes a clocked AND gate, and two in parallel make a clocked OR gate.

Why would [Xander] embark on this legendary endeavor? Apparently after over eight thousand hours clocked in game, one gets a bored of killing slimes and building NPC houses. And playing with the game’s wiring system turned on a metaphorical lightbulb, that the system could be used to build interesting systems. A prototype CPU, with a completely custom instruction set came next, and was powerful enough to compute Fibonacci. But that obviously wasn’t enough. Come back after the break for the rest of the story and the impressive video demonstration.

Continue reading “This RISC-V CPU Games In Rust From Inside The Game”

The Math That Makes Computers Go, Built On A Tiny PCB

A computer is, at its core, just a bunch of transistors wired together. Once you have enough transistors on a board, though, one of the first layers of abstraction that arises is the Arithmetic Logic Unit. The ALU takes in two sets of data, performs a chosen math function, and outputs one data set as the result. It really is the core of what makes computers compute.

An ALU is built into modern processors, but that wasn’t always how it was done. If you’re looking to build a recreation of an early computer you may need a standalone, and that’s why [roelh] designed an ALU that fits in a square inch piece of circuit board using five multiplexer chips and two XOR chips.

One of the commonly used components for this purpose, the 74LS181 ALU, is not in production anymore. [roelh’s] ALU is intended to be a small footprint replacement of sorts, and can perform seven functions: ADD, SUB, XOR, XNOR, AND, OR, A, B, and NOT A. The small footprint for the design is a constraint of our recent contest: Return of the Square Inch Project. Of course, this meant extra design challenges, such as needing to move the carry in and carry out lines to a separate header because there wasn’t enough space on one edge.

Exploring the theory behind an ALU isn’t just for people building retrocomputers. It is integral to gaining an intuitive understanding of how all computers work. Everyone should consider looking under the hood by walking through the nand2tetris course which uses simulation to build from a NAND gate all the way up to a functioning computer based on The Elements of Computing Science textbook.

If you’re a homebrew computer builder, it might be worthwhile to use one of these ALUs rather than designing your own. Of course, if building components from scratch is your thing we definitely understand that motivation as well.

Trek To Evil Mad Scientist Laboratories

I’ve been a huge fan of EMSL for quite some time now, and my recent field trip proved that it has earned the name Evil Mad Scientist Laboratories for a good reason. For instance, look at the reflection in the glass near the bottom and you’ll glimpse the hearse that [Lenore] and [Windell] have sitting in front of the shop. But stop at the threshold, inside there are delights that ate up a couple of hours without me even noticing. And they thought they were going to get work done that day.

Don’t judge me by my appearance. This is late afternoon on a summer Saturday in Sunnyvale. Why does that matter? Obviously summer Saturdays in Silicon Valley always start with the Electronics Swap Meet and Engineer’s breakfast! That was a ton of fun but if you’re doing it right it’s also a bit tiring. No worries, a shot of excitement came over me as soon as I walked in that front door.

Continue reading “Trek To Evil Mad Scientist Laboratories”

Java Grinder Spits Out DsPIC And MSP430 Assembly Code

java-code-grinder

[Michael Kohn] sent in a link to the set of projects he’s been working on lately. The Java Grinder is a project that converts Java code for use on microcontrollers. This actually started back in 2009, when he mentioned that the project was worthless because there were already a ton of Java virtual machines out there. But if he had really thought that he’d never learn anything. We’re glad [Michael] picked this back up and made something out of it.

The image above shows the proof of concept. It’s a box bouncing around the Nokia 6100 screen. He wrote the animation in Java, and used his grinder to turn the code into dsPIC assembly, which was then compiled and flashed onto the microcontroller. That’s not all, he’s also coded a Mandelbrot set generator or the same hardware. As it stands he can also produce assembly code for use on MSP430 chips.

This kind of exploration is great for the brain. We see it as a natural extension of the learning you acquire from Nand2Tetris which walks through the essential text The Elements of Computing Systems. If you’re not familiar, that’s a trip from building your first logic gate, which you plunk together with others to build an ALU, then start coding all the way up to a virtual machine to run on your simulated hardware.

Video of the bouncing box and Mandelbrot set is below.

Continue reading “Java Grinder Spits Out DsPIC And MSP430 Assembly Code”

Cornell ECE 4760 Lecture Videos Now Online

Whenever we hear about ECE 4760 we take notice. That’s because a ton of fantastic hacked together projects have resulted from the class. It’s offered at Cornell University and focuses on designing projects based on microcontrollers. We look at it as a ‘how to connect everything to your microcontroller’ guide. The good news for you is that 34 lecture videos from the Spring 2012 ECE 4760 class are now available to watch for free online. When coupled with the course webpage itself (which outlines the reading, labs, and homework) this turns into an opportunity to work through the entire course on your own schedule.

If you need a brief preview, here’s a couple random things we’ve seen as final projects from the course: a digital saxophone, a handwriting decoder, and a haptic feedback unit for building your biceps.

We’re still working our way through the Nand2Tetris project, but we’re putting these lectures on our watch list for later.

[via Reddit]

Programming Tetris By First Building A Logic Gate, Then A Computer, Then…

Hone your fundamental understanding of computer systems by completing this online course called NAND to Tetris. The idea is to develop each fundamental unit that goes into making computer programs a reality. This starts with logic gates, which are put together into modules that eventually become a functioning computer. From there you need an operating system,  a compiler, and eventually you’ll be playing a game of Tetris which you programmed yourself.

It’s certainly not an easy journey, but if you have a computer at your disposal you should be able to make it all the way through the course. There’s a software suite which includes a hardware simulator so that the computer you’re building can be assembled using HDL instead physical components.

The concept is discussed in this TED talk given by [Shimon Schocken]. It is also embedded after the break and in addition to the NAND to Tetris project he shows off some self learning software on the iPad. To us it seems very much like the learning software [Neal Stephenson] envisions in the Young Lady’s Illustrated Primer from his Diamond Age novel.

Continue reading “Programming Tetris By First Building A Logic Gate, Then A Computer, Then…”