Sunday, December 20, 2015

Raspberry Pi and Electronics

Recently I bought a few interesting things from Amazon.
  1. Of course, the Raspberry Pi 2 - I think I mentioned that already
  2. SunFounder project super-starter kit for Raspberry Pi 2
  3. A book titled "Make: Electronics" by Charles Platt
  4. Companion pack 1 and pack 2 for the book
With all of that I have been working through learning electronics and the Raspberry Pi 2 (and I also have an Arduino, although I'm keeping it aside for now until I am done with the other two).

The goal? In my undergraduate days, I learned Computer Architecture using Hennessy and Patterson Computer Architecture 3rd edition, and was inspired by the book as well as NACHOS which we used in our Operating System class, to write a MIPS R2000 5-stage pipeline simulator for one of my undergraduate projects. Recently, I put it up on Github under the name Coconut (in keeping with choosing fruit names for computers). Now I would like to make the same in hardware, as an educational processor.

Looking into the world of home built processors, I found a pointer to Bill Buzbee's Magic-1 which can be found at http://magic-1.org. From there I found his main page http://www.homebrewcpu.com/links.htm and a link to Dave Brook's iiNet Ring of home built CPUs ! All of it looks pretty cool.

Anyhow, maybe I can do this - we'll see. I also found this rather interesting pair of books
  1. James Hendrix: A small C compiler. This book seems to be about writing a compiler for a trimmed down version of C. If I make a CPU, I'll need a compiler for it. Unfortunately, this book is not in print, and used copies are rather pricey. However, it seems like this github project https://github.com/rui314/8cc is essentially the code from that?
  2. Ronald Mak: Writing compilers and interpreters. The first edition of this book writes a Pascal compiler in C. Unfortunately the author ported it in a rather ad hoc and unsuccessful fashion into C++ for the 2nd edition and into Java (really?) for the 3rd edition. Anyhow, I found a used copy of the first edition rather cheap. 
Maybe that will be my resources for writing a compiler for a more advanced language (I wrote an assembler for my simulator) if and when I do get to create my not-so-micro processor!

Anyhow, on a side note, here is a 101 project I did using the Raspberry Pi.


I found this amazing program Fritzing (http://fritzing.org/home/) which helps you design electronic circuits rather easily. Here's a schematic of the project that I made using fritzing:
And here's the breadboard layout.


The schematic and breadboard layout can also be found at https://github.com/varghese85/raspberry-pi

.

No comments: