# Homebrew CPUs/Low Level Design

So i've been urging to really expand into the embedded field, I have a CS degree but sadly....I only had 2 EE Classes. I have the books:

Computer Architecture: A Quantitative Approach, 4th Edition and
Computer Organization and Design, Fourth Edition: The Hardware/Software Interface


However My EE classes were.....lets say lacking, not to mention I never had time to attend the optional labs (because of other classes). But I REALLY really want to learn the low level in CPU design. Im talking low level TTL design, however I don't really know any of it from College, and honestly....I see alot of "Cool" homebrew CPU's people have built, but nothing on HOW it's done. Keep in mind my Electronics knowledge is limited.

So how would I go about doing this, would those 2 books above help? Any other book suggestions? Im talking about something really basic, like a 4 bit or something. I can add to it as time goes, but even something super basic would be great.

Thanks

• The books are only useful when you read them... Your question implies that you did not. – Turbo J Aug 31 '11 at 0:14
• Check the library for earlier editions of CA-AQA, I don't recall which one, but one had a good explanation from the basics up. These are VERY good books, each edition being a completly new book. – Wouter van Ooijen Aug 31 '11 at 6:18
• Any EE class where the labs are optional is a bad EE class. The labs are where you learn the real world. – Mike DeSimone Aug 31 '11 at 13:01
• @Turbo, Well i've read a little bit, but I didn't know if they were WORTH reading. – user3073 Aug 31 '11 at 13:38
• @Sauron, they are WORTH reading but you don't need to read them both as there is a bunch of overlap. Stick to the first one. – sybreon Sep 1 '11 at 2:13

What you're thinking of doing could be accomplished with 74xx series medium scale integration (MSI) chips, such as were available in the late 1970's, and more easily with some of the more recent 74xx's that were added in the early 1980's. If you can find a databook for this series, especially a later, mid-1980's one, that has pin-outs and logic diagrams, it will be invaluable for such an endeavor.

If you can look at the specs for the 74LS374 and understand how it might serve as an 8-bit register, it shouldn't be too much of a stretch to see how you could connect these on buses so as to be able to move data around between them. Investigate the 74LS181 and you can basically get all the math capabilities of the venerable 8-bit 6502 CPU in one swoop. The trickiest part is the control circuitry to execute instructions by sequentially operating all the registers, buffers, and ALU in the right order. If you only took a couple of EE classes, this will probably be your major stumbling block.

To get oriented with this level of design, you might try something like "Microprogramming and Computer Architecture" by Bruce Segee and John Field. Used copies can be had for cheap at a certain on-line book seller.

• Seems that book is rather difficult to find online :/ – user3073 Aug 31 '11 at 14:15
• From the practical EE viewpoint: Don't forget the decoupling capacitors, or debugging your digital circuit will be hopeless. – Yann Vernier Aug 31 '11 at 16:58
• @Yann Vernier - that's par for the course with any kind of TTL project though. – JustJeff Sep 1 '11 at 0:53
• @Sauron - Did you try to find it online? Amazon.com has 7 in stock for under $10: amazon.com/gp/offer-listing/0471506885/… – Kevin Vermeer Sep 1 '11 at 1:02 • By all means go ahead and wire up boards full of TTL if you want to - but in this day and age, consider simulating the project first to see if you have a workable design. In particular, put thought into a means of loading code, generating output, and perhaps either a hardware single step & examine mechanism, or a single step mode that can be used to keep jumping back to a software register dump routine. – Chris Stratton Sep 1 '11 at 1:31 I can recommend two books aimed at learning digital logic: # Fundamentals of Logic Design by Dr. Charles Roth This book is intended as a textbook for a self-paced first-year undergraduate class on logic design, and is broken up into several small chapters with self-study parts and problems at the back. In the introduction, there's a recommended order for the chapters. Some of the chapters are optional, but I'd make sure to do Appendix B (IIRC) which covers digital input and output circuits, which you will need to deal with. # TTL Cookbook by Don Lancaster If you're going old-school, this is the old-school book you want. Written in the 70's, it focuses on 74xx series TTL logic, culminating in a project to build several circuits for a "TV Typewriter", which just lets you type on a TV set. (I mentioned old school, right? This was when 8-bit microcomputers like the Apple II were hundreds of dollars, not some$10 Arduino.)

Don Lancaster also wrote a CMOS Cookbook if you want to use the even slower 4000 series CMOS logic, which can run on voltages from 5 to 15 V, but leads to 5V HCMOS logic, which leads to modern low-voltage, high-speed CMOS.

The main difference between these books is that FoLD will give you the EE-grade tools to do it right (like using a Karnaugh map to work out the optimal next-state logic for a state machine, which you can then map to a PAL, GAL, or discrete logic), while the Cookbooks focus on all the tricks to make your life easier (like using a bunch of 1-of-16 encoder/multiplexers to encode your combinational logic so you just have to rewire a few pins to fix bugs; bigger chips, but easier debugging).

Once you have this down, the Computer Architecture books will make a lot more sense because you'll look at it and know what a register, adder, subtracter, multiplier, state machine, and tri-state bus are, and parts like instruction decoders and load/store units won't be as scary because you'll know how to break large design blocks down into smaller state machines.

This might be of some interest - free online content of a college course covering things like the block diagram of a simple cpu and implementation of the various pieces, including lab exercises.

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/

Reading the H&P books are very useful. However, they don't deal with the EE stuff. So, I would also encourage you to supplement it with a book that takes things from the transistor level up such as Structured Computer Organization - Andrew S. Tanenbaum.

Once you have an idea of how a processor architecture looks like, you can fill in the details with examples from various EE books e.g. designs of adders, multiplexers, shifters, etc.

That will put you on the right track.

Edit Another useful book is Logic and Computer Design Fundamentals by Mano and Kime, which is more a book for EE students than CS students.

• That seems to be the biggest problem, they deal less with the ACTUAL hardware, which is what im interested in. – user3073 Aug 31 '11 at 16:26
• Yes, but the H&P books give a good view of the overall structure. To learn the actual hardware, you need to go down to digital electronics e.g. the Mano/Kime book I added in my answer. – sybreon Sep 1 '11 at 2:11

Open source to the rescue. Visit http://opencores.org/ and start playing around with some projects, for example you can start learning verilog right away. Work on learning top-down since you're a CS guy already. (By attempting to take digital circuits classes you are going bottom-up which will be more difficult for you.)