News:

The Savage///Circuits website has been upgraded to a more efficient theme.

Main Menu

The Adventure Begins (Diving Deeper into the Z80)

Started by MicroNut, May 04, 2025, 10:04 PM

Previous topic - Next topic

MicroNut

I decided this weekend to jump back into my electronics hobby by making my own version of the Z80 for my FPGAs. I have found a site that already has made one by reverse engineering the Z80 die. The site highlights some logic and also has schematics of the logic.

It is my intent to use a Logic simulator called Digital to copy these schematics into it. The simulator can generate truth tables, Verilog and VHDL code. It also runs test scripts. Using the simulator I will be able to test the validity of the schematics and to better understand the logic. Once that is done I will make the FPGA softcore with what I learned.

Eventually I will make a minimal operating system on my DE10-Lite and use a serial terminal to communicate with it.

As I go through this I plan to document my findings. I remember having the book ZX81 Explorer's Guide which was a very good book and was a bit light hearted as well. I found that refreshing so I'm writing it in the same style. I even had AI generate cover art for it which I attached.

I have a Github account and will post everything as I go along with this project.

EDIT: Changed the cover art to something I liked more.

Always looking to the stars.

MicroNut

Just got my Github site up. The guide only has a forward, introduction and chapter holders as an outline. This will probably change somewhat as I go through my research.
Always looking to the stars.

granz

Quote from: MicroNut on May 07, 2025, 05:36 PMJust got my Github site up. The guide only has a forward, introduction and chapter holders as an outline. This will probably change somewhat as I go through my research.
I got a 404 error.

Is your page open to people who are not logged in? I had something like that happen to my son, and it turned out that he had something marked so that only people who were logged in could see it.

MicroNut

I had the repository set to private. I changed it to public. I then tried it without logging in and it works for me.
Always looking to the stars.

granz

I was able to get in, and read now, thanks.

It's looking pretty good, so far.

JKnightandKARR

Quote from: MicroNut on May 07, 2025, 10:17 PMI had the repository set to private. I changed it to public. I then tried it without logging in and it works for me.
I was able to get into it as well.

granz

Brian,

I was just looking over your book again. If you don't mind some critiques, the crumpled paper background, along with the weird font, make reading a bit of a chore. The material seems pretty good (so far I've gotten through your introduction) but it's a bit rough reading (probably mostly my old eyes.  :-[ )

The best reading, for me, is a simple Times New Roman, or Ariel, font, on a plain solid-color background. Also, be careful of the contrast - I've been running across web sites where they have a very light gray font, on a nearly the same background. That is very difficult, and I've actually had to leave some sites, in spite of very interesting material on the site.

Chris Savage

Question: on page 8, are the clk and oe labels reversed? It looks that way to me.

                     Bringing concepts to life through engineering.

granz

I saw this posting in the RetroComputing forum, and thought about your book:

https://retrocomputingforum.com/t/hello-i-wrote-a-book-about-the-z80/6319

It looks like he will be selling it; maybe you could get a few bucks from your book.

MicroNut

I stopped mine because my intent was to explain the logic of the Z80 from another person's reverse engineering into logic blocks for use in a FPGA and when I got to the Program Logic Array that decodes opcodes he wrote it in python. The python was quite extensive and I felt it would be too time consuming to figure out the logic. I did get permission to use his reversed engineered schematics and since he made it freely available I felt it was only fair that mine was free as well.

I have decided to do more background work before moving on so I'm using a logic simulator, LogiSim-Evolution and the book Build your own computer from scratch to get more familiar with the architecture and logisim. I also found various sites building a cpu for a FPGA.

The next few months I'm going to research this then attempt a COSMAC 1802 then a Z80 in LogiSim and if successful I'll do a rewrite for building a 1802 and Z80 in LogiSim. The LogiSim-Evolution version has a fpga export function that can be customized for specific boards.
Always looking to the stars.

granz

I had not heard of Logisim Evolution, and thought that all Logisim development had ceased and gone to Digital logic simulator.

It appears that Digital is more advanced (more built-in circuits) than Logisim, but where does Logisim Evolution fit? It would seem that it should be more than Logisim, but is it better than Digital, too?

I like the book that you mentioned, but did you know that Richard Whipple wrote a second "from scratch" book? In Build Your Own BASIC: From Scratch he continues his computer project by going on to build a high-level language for it. The write up also mentions that he actually builds the computer from his first book on an Intel Cyclone V FPGA. It seems like it would be pretty cool. Maybe the FPGA implementation could help you with your project(s).

granz

Nope, taking another look at the description of the first book, it appears that he actually did build the CPU into an FPGA in that book, rather than the software sequel.

The issue comes from:
QuoteWe first test Tiny BASIC on a simulated BYOC-24 CPU using the freeware application Logisim. Later, we make Tiny BASIC fully functional using an Intel Cyclone V field programmable gate array.
From the second book.

and:
QuoteThe remaining chapters, 11 and 12, cover the actual hardware implementation of the computer design in a Field Programmable Gate Array.
From the first book, which I had not read until after I read the second book's description.

I wonder if he put the CPU onto one FPGA in his first book, and then a different one (which he calls BYOC-24) into the Cyclone V chip. Enquiring Minds want to know.  :P  ;D

One of my oldy-and-moldy projects (probably about twenty years old ::) ) was to put Dr. Jones Ultimate RISC onto Logisim, and then onto actual 74xxx hardware. Maybe someday...

MicroNut

I was also looking into Digital thinking it was better than Logisim. Both use "subcircuits", modules that contain logic circuits that can be added to the main circuit. Digital's are more reusable but during simulation you cannot trace through a subcircuit while in Logisim you can. Digital is only maintained by one individual and the last beta version was 2023. So Logisim is easier to debug.

Logisim was discontinued but has been forked into Logisim-Evolution, Logisim-Ita and Logisim-Dark. The last version of Logisim-Evolution I got was from 2026 so it is currently being maintained by an university. With it's FPGA export it is simpler to do than the last few chapters of Whipple's book. Sadly the Logisim example on Whipple's github site does not translate well into Logisim-evolution because of all the modifications. I'm currently doing the port to Logisim-Evolution by hand.
 
Always looking to the stars.

granz

Interesting. If I ever resurrect Dr. Jone's U-RISC project, I will need to look into Logisim Evolution. Thanks.

I do remember the sub-circuits - I was working on creating a couple of the 74xxx chips that I needed for U-RISC.

SMF spam blocked by CleanTalk