Many ideas have been whirling around in my head since being at DAC. I've been inspired to learn some new things, starting with the Open Verification Methodology but also revisiting some of the Electronic System Level tools and flows that I've worked with in the past. I'm interested in exploring visualization techniques and tools and how they might be applied to verification and design. I'd also like to learn more about a few of the more interesting formal verification tools, like OneSpin 360 MV and maybe explore what is possible with ESL tools like Bluespec's SystemVerilog flow or the various other similar tools that are out there.
I have a difficult time learning things just for the sake of it, tending to be more driven by necessity rather than idle curiosity. I've been doing some work based around a small CPU core and started getting frustrated with the way the CPU was architected. This led me to start considering designing my own CPU, just for fun. Partly as a motivation to crack open a Hennessy & Patterson book that I've been meaning to read for a few years, partly to see if I can do it, partly as a vehicle to hang all those other ideas upon.
I've been looking around the web, browsing on OpenCores and finding humbling projects, such as HomebrewCPU, which is a Minix-compatible CPU entirely constructed from discrete gates. You can even browse the web pages that it is serving or telnet in to it! To my way of thinking, that is slightly nuts - impressive, but nuts all the same - five wire-wrapped boards to debug. My background is in FPGAs and that seems the perfect technology for this sort of exploration - I'm also thinking along the way that I might be able to play with synthesisable verification or FPGA enhanced verification/ emulation as well as possibly using this as a platform for a reconfigurable architecture. Lots of ideas, potential and possibilities. It will also give me a chance to re-engage with FPGA technologies and learn about more about the state of those tools. The various tools are getting to a fairly mature point and a simple pipelined CPU shouldn't require too much work but still be complex enough to do interesting things with.
I've been looking at Xilinx and Altera to get an understanding of their current tool flows and trying to work out language support and maturity - which would be the best option for systemVerilog, where the best simulation options are and that kind of thing. No real conclusions yet, but both have trial versions of what appears to be a complete tool chain, so I will probably drive a small example through both flows as a pipe cleaner.
Then of course there are the more fundamental religious issues - CISC or RISC, what ISA to use. Roll my own, pick up an already defined but open architecture, or something in between? I'm looking for suggestions in this respect - I know ARM are quite litigious when it comes to cloning their ISA, so I'll be avoiding that, but OpenSPARC might well be a good option. Any other suggestions? I'm not sure if the early MIPS ISAs are cloneable without problems? Maybe I could go really back to my roots and implement a Z80 architecture. The advantage of picking on an existing ISA is that the tools come mostly for free. While porting gas and gcc to my own ISA could also be an interesting experiment and learning experience, it would probably be more of a distraction than I want.
I am a fan of the Python language and tend to write most of my personal projects in it. As a result, I'm intrigued by the potential for writing the core in Python, using some of the available extensions and libraries. Two packages seem to already exist, MyHDL and PyHVL. MyHDL is Python extension to let you express parallel behaviour that can then be automatically translated to verilog or VHDL. PyHVL provides the other piece of the Python puzzle, enabling high-level verification in Python. So potentially I could do the design and verification in Python then drive through into an FPGA flow for implementation. JL jokingly mentioned the potential for an OVM port to Python but maybe it isn't such a crazy notion. The thing that Python is fantastic for is expressing complex ideas quickly and without a lot of fuss or housekeeping. From the verification perspective it seems to be a perfect match as I can focus more on the testing, and less on the language. I'm a bit more skeptical about using it on the design side but I think it might be worth a look.
To kick things off, I found the description for a minimal CPU on opencores. This is a really basic 8-bit processor, 4 op codes, couple of registers and a very simple, small architecture, yet it can still do some useful function. This evening I wrote a Python ISS for it, just to prove out some ideas. Took about an hour to get a working cycle-based ISS together for the architecture. Of course, immediately the next thing you need is an assembler and that was fairly easy to put together in Python too. Nothing particularly complex, but a two pass assembler that supports labels and constants and generates code that runs on the core. I'm able to assemble and run the example greatest common divisor (Dijkstra's algorithm) described in the paper and it has given me a good indication of the direction to go. So far, my couple of hour project can assemble and execute the following code:
start:
NOR allone ; akku == 0
NOR b
ADD one ; akku = -b
ADD a ; akku = a - b
; Carry set when akku >= 0
JCC neg
STA a
ADD allone
JCC end ; A=0 ? -> end, result in b
JCC start
neg:
NOR zero
ADD one ; Akku = -Akku
STA b
JCC start ; carry not altered
end:
JCC end
a: 10 ; a & b are the two values to consider
b: 30
allone: 0xff ; various constants
zero: 0
one: 1
Next step is to describe this trivial core in a synthesisable form and see how I get on running it through one or two FPGA flows. A few tests and some verification could be useful too! For FPGAs I'm much more used to the general suck it and see style of testing that is the norm. Synthesize, place and route and see if it works. In the last several years I've been working on much larger ASICs so have certainly seen the value of more robust verification and I think FPGA technology has probably spent too much time as the wild frontier of design robustness and testing. As this project progresses I want to explore what the best balance is for testing and how the test environments can use the FPGA to accelerate testing along the way.
So plenty of things up in the air but I think this could be fun.

Python for hardware design expression is not /that/ crazy. Dillon Engineering presented their approach at HPEC last year; and were giving out free O'reilly Python Pocket Refs to keep us thinking about it. Me, I'm much more comfortable with Bluespec for design expression where h/w the uArchitecture trade-space must move fast-and-furious. What would be interesting is exploring hw/sw co-design in a platform merging Python and Bluespec SystemVerilog. Fun for sure. -Shep
Posted by: Shepard Siegel | June 22, 2008 at 06:40 AM
Perhaps I've gotten the wrong interpretation of your aspirations, but my advice is "Go RISC, young man". The "minimalCPU", and even the Z80, just won't scale up to any non-trivial exercise.
Unless you go to a Load/Store instruction set, there won't be any need to crack open the Hennessy&Patterson at all. Much of the fun stuff (hazards, branch penalty) surrounds the pipeline, and pipelining a Memory Operand instruction set is painful. Not ridiculously hard, but pointlessly hard. And using an Accumulator architecture is nailing one foot to the floor before you even start. Nor can I see any chance to explore cache or virtual memory with a 64 byte address space.
Posted by: kevin johnston | June 22, 2008 at 07:34 PM
Hi Kevin, thanks for commenting. I pretty much agree with your assessment of this. The M-CPU was just the simplest example that I could try out a few ideas with quickly. I can make an ISS, write the assembler, run it through FPGA tools etc, very quickly to work out which flow makes sense.
A load/store sort of architecture was what I was really thinking about doing for the real thing, for many of the reasons you mentioned.
Posted by: GordonMcGregor | June 22, 2008 at 09:57 PM
Hi Shepard,
Thanks for the comments and pointer towards Dillon Engineering. I've been looking in to the various options for Python design and verification. I tend to see it as being more useful for writing verification code than really true HDL replacement, so I suspect the path you mentioned (Python + SystemVerilog) could well be a fruitful direction to go in.
Posted by: Gordon McGregor | June 27, 2008 at 10:00 AM
Hi,
Could this be not something to play with?
http://archc.sourceforge.net/
It's a sort of SystemC language to build and play with processor models.
The presentation a long time ago at the DATE in Paris was nice.
Posted by: Jan | September 03, 2008 at 07:56 AM