views:

1580

answers:

9

How can I make my own microcontroller? I've done some work using GAL chips and programmed a chip to do simple commands such as add, load, move, xor, and output, but I'd like to do something more like a real microcontroller.

How can I go about doing this? I've read a little bit about FPGA and CPLD, but not very much, and so was looking for some advice on what to get and how to start developing on it.

+10  A: 

You may want to have a look around OpenCores.org, a "forge" site for open source IP core development. Also, consider getting yourself a development board like one of these to play around with.

Much of the tools ecosystem revolves around VHDL, although Avalda is working on tools to compile F# for FPGAs.

Jeffrey Hantin
+1  A: 

A microcontroller can be as simple as a ROM (instruction*2^x + (clock phase) is the address, outputs are the control signals, and you're good to go). Or it can be a complex harry beast with three arms and branch prediction support hardware.

Can you give more details about your aspirations?

MarkusQ
I'd like to implement something similar to an AVR possibly, though I know it would be much simpler.When I was using GAL chips, the class I was in quickly reached the physical limits of GAL, and I wanted to know what is the next step that I can take to making something a little more powerful.
samoz
A: 

You can get free samples of pic micro controllers at this site. Last I knew, you don't even have to pay shipping.

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=64

NotDan
The OP's question is about learning to design the PIC itself, not about using things like it.
RBerteig
+14  A: 

Look here for a good wiki book. I had some coursework I wrote when I was teaching Electronic Eng, but I couldn't find it around. When I was teaching, most of the students were happy to use the schematic capture tools in the Xilinx Foundation package. They've moved onto ISE and WebPACK now. You can download the WebPack for free, which is useful, and it has schematic capture and simulation in it.

If you really want to shine, learn VHDL or Verilog (VHDL seems to be more common where I've worked, but that is only a small smattering of places) and code the design rather than enter it through the GUI.

If you know ANYTHING at all about digital logic design (and some HDL) I rekon you can have a somewhat functional 8-bit microprocessor simulating in VHDL in about 2 days. You're not going to build anything blazingly fast or enormously powerful in that time but it's a good starting point to grow from. If you have to learn about digital design, factor in a couple of days to learn how the tools work and simulate some basic logic circuits before moving onto the uP design.

Start learning the basics of digital systems, and how to build a binary adder. Move on to building an ALU to handle addition, subtraction, and, or, xor, etc and then a sequencer to read opcodes from RAM and supply them to the execution unit.

You can get fancy with instruction set design, but I'd recommend starting out REALLY simple until you have your head around whats going on, then throw it out and start again with something more complex.

Once you have the design simulating nicely you can gauge its complexity and purchase a device to suit. You should look at a development system for the device family you've chosen. Pick a device bigger than what you need for development because it's nice to be able to add extra instrumentation to debug it when it's running, and you almost certainly won't have optimized your design in the early stages of getting it on the device.

EDIT: Colin Mackenzie has a good tutorial about uC design and some FPGA boards as well as a bit of other stuff.

Adam Hawes
A: 

You need a big fpga for a little mcu.

You need a fpga with the correct hardware blocks if you need things like AD.

You need a soft core to put into the fpga.

But how about to just play around with a normal MCU before this project, so you kind of know where you are going? How about some AVR:s from Atmel.

Johan
I actually have several AVR chips already ;)
samoz
But then you are not that green as you question implies... Maybe a update to your question.
Johan
+1  A: 

After searching some very helpful links by all of you, I came across this Wikiversity course.

One of the first sentences is, "Have you ever thought to build your own microprocessor?"

samoz
+4  A: 

I saw a textbook once that stepped through building a machine from TTL chips. This had the same instruction set as a PDP-8, which is very - and I mean very - simple, so the actual machine architecture is easy to implement in this way.

The PDP-8 FAQ mentions a book: "The Art of Digital Design," second edition, by Franklin Prosser and David Winkel (Prentice-Hall, 1987, ISBN 0-13-046780-4). It also mentions people implementing it in FPGA's.

Given the extreme simplicity of this CPU architecture and availability of PDP-8 code or reference implementations it might be a good starting point to warm up with.

ConcernedOfTunbridgeWells
+1 just for mentioning the PDP-8 ;-)
RBerteig
+2  A: 

To play with soft-core microprocessors, I like the Spartan 3 Starter Board from Digilent just because it has 1M of static RAM. SDRAM and DDR RAM are harder to get going, you know.

The leds, switches and a simple serial interface are a plus to debug and communicate.

As someone already pointed out, OpenCores.org is a good place to find working examples. I used the Plasma uC to write some papers while on university.

Marcelo MD
+1  A: 

Xilinx has a MicroBlaze and a PicoBlaze soft controller for its FPGAs. The latter is free, while, IIRC, the Microblaze is to be paid for.
As its name suggests the PicoBlaze is a small processor, which has its limitations, but OTOH is compact enough to run on a CPLD. Anyway a nice processor to get you started.
Pablo Bleyer has a PicoBlaze-compatible PacoBlaze. PacoBlaze was written in Verilog (which, like Adam said, less common than VHDL).

stevenvh