Electronics: A 10-Bit Full Adder

Now it’s time for something completely different.

I know this website is mainly vehicle focused (hence the name “Motors” in the name), but like most people, I have another hobby – electronics. Now, sometimes these two hobbies intertwine, which will be the next post I make, but for this post… they don’t. So, hang in there and automotive content will return soon!

Since this post is obscenely long, go ahead and watch this video first to see where we’re headed.

Now, before I get too deep into what on Earth you’re looking at in that picture, go to Youtube and watch all of Ben Eater’s videos on building an 8-bit computer from scratch. The man is brilliant and one of the best teachers of electronics I have ever seen.

Ben Eater’s Youtube Channel

I’ve dabbled into and out of electronics ever since I was a kid, making radio kits then, and upgrading into BEAM robotics and desktop trinkets. BEAM is incredibly interesting because it’s robotics with no programming and usually solar powered, so the designs have to be incredibly efficient (and usually misuse components to get the job done).

But, the desire for more complexity leads to programming. Now, when we think of programming we often think of high-level programming. These are languages like C#, VisualBasic, Javascript, etc. However, those languages don’t really give you an insight into how exactly the machine works, and if you frequent this (rarely updated) site, you know that I like to know how things work. For this, you need to dabble into low-level programming, like Assembly, or ASM. However, if you dive straight into ASM, you’re very likely to get completely and totally lost. It actually makes more sense to go one step lower into how the actual machine works, without thinking about programming at all.

And that’s where this story begins.

The primary building block of any and all computers is binary. A “1” or a “0”. This is because binary can be represented as “on” or “off”, or more simply, 5 Volts or 0 Volts. One point that can be either 5 Volts or 0 Volts is what is called a “bit”. That bit can be on or off, or a 1 or 0. String eight bits together for something that looks like this “0011 0101”, and you’ve got yourself a “byte” of information. String together 1,000 of those and you’ve got a “kilobyte”. String together a thousand kilobytes and you’ve got a “megabyte”. A thousand megabytes, and you get a “gigabyte”. Then a “terabyte”, then a “petabyte”. As of writing this, petabytes of storage are slowly starting to become more commonplace and big server farms are actually pushing into “exabytes”, with Google supposedly having 10 to 15 exabytes of storage space.

Now, storage is one thing, but computers actually do stuff. And by stuff, I mean “math”. Everything is based around adding numbers. Even subtraction, multiplication, and division are all some derivation of addition. For, example, if I want to multiply 12 x 5, all I really do is just do 12 + 12 five times.

But remember, computers work in binary, so if we want to do 12 + 12, that’s actually 1100 + 1100. Now, that looks strange, but since binary can only be a 1 or a 0, we have to do a little mental math to figure out what number is represented by those four bits. Binary reads from right to left, like Japanese, with the right most bit being worth 1, the second most bit worth 2, the third most worth 4, the fourth most worth 8, and so on, doubling each time.

1100 is 8 + 4 + 0 + 0, which is twelve. 1111 is 8 + 4 + 2 + 1, which is 15. 0101 is 0 + 4 + 0 + 1, which is 5. You can see that with four bits, we can represent any number between 0 and 15. Now, how do we add two numbers together?

Like normal addition, you add the top number to the bottom number. And in normal addition, if the number is larger than 10, you write the first digit down below and “carry” the second digit over to the next column you’re adding together. The same principle applies here, but you carry a 1 if the number adds together to be larger than 1. If we add 1 + 1, the answer is two, which is 10 in binary. So, you write the 0, and carry the 1 to the next column. If you have a carry in your column already and you add 1 + 1, you have to add the carry as well, so that becomes 1 + 1 + 1. The answer is three, which is 11 in binary. Write the 1 and carry the 1 to the next digit.

Awesome, now we know how to add binary, it’s easy peasy from here, right? Not quite, 4-bits of binary is any number up to 15. If I want to add larger numbers, I need more bits. 8-bits of binary is any number up to 255, 16-bits any number up to 65,535, and so on. But wait a minute, there were tons of 8-bit and 16-bit systems and PCs, like the NES/Famicom, NEC-PC8001, TI-99/4A, etc. Being 8-bit meant it could only do math on 8-bits at a time. So, how did they do math on large numbers? Loops! That’s how. Instead of adding or subtracting the entire number at once, they break it up into 8-bit sections, and then loop through until they have the answer. Here’s an example with some random numbers:

3,692 + 4,503

3,692 in binary is 0000 1110 0110 1100

4,503 in binary is 0001 0001 1001 0111

Now, you just do the math on the first eight bits and then loop around and do the math on the second 8 bits. The first 8 bits of 3,692 are 0110 1100 and the first eight bits of 4,503 are 1001 0111.

0110 1100

1001 0111

From right to left adding the top number to the bottom number:

0+1 = 1

0+1 = 1

1+1 = 0 (1) > The parenthesis is our carry

1+0+(1) = 0 (1)

0+1+(1) = 0 (1)

1+0+(1) = 0 (1)

1+0+(1) = 0 (1)

0+1+(1) = 0 (1)

So, the first 8 bits of our answer should be 0000 0011. In a computer, we’ll store this somewhere, like a Register, which is a temporary memory location. Then we do the same procedure for the second eight bits. The actual answer is 8,195, which is 0010 0000 0000 0011. You can see that the first eight bits (from right to left) are the same as those the we just figured out doing the math manually. Okay, that’s how addition in binary works. I won’t go into subtraction because it’s a little more complicated, but you get the idea.

Now we’re getting to the meat and potatoes of this (obscenely long) post. Like old cars, I’m fascinated with the technology of the 40s, 50s, 60s and 70s. For cars, more into the 60s and 70s, but for electronics and computer, more into the 40s and 50s. And, one of my ultimate goals is to someday create a relay computer, like those that were used before and in direct competition with vacuum tube computers. Yes, relays, like the click clack on/off type. I’m of course not the first person to ever think of this, relays are fantastic for making logic gates (AND, OR, NOT, NAND, NOR, XOR, and XNOR). Logic gates are another massive post, so I’ll just mention them here and if you’re really curious, check out the link below.

Wikipedia Entry on Logic Gates

This is the FACOM 128, a relay computer made by Fujitsu in 1956 that uses around 5,000 relays to do some pretty fantastic math.

Obviously, I have zero intention of buying 5,000 relays and trying to build something on that scale, but I think relays sound therapeutic and are fun. Also, obviously, relays do have their limitations. To make something 8-bits wide with relays is difficult. It takes a massive number of relays, which takes up a lot of space and money. 4-bits is much easier, but if we’re just doing simple math, as we saw earlier, all that means is we’re just doing loops. We can loop around as many times as we need, so what if we only did 1-bit? Sure, it’d be a lot slower, but the little Omron relays I’m using have a limit to how fast they can switch on and off, which means if I pushed them to their absolute maximum, I could almost get 1 KHz of processing speed. So, speed went out the window a long time ago.

Enter my idea for 10-bit addition/subtraction calculator that uses a 1-bit ALU (Arithmetic Logic Unit).

I started designing and came up with these six boards to achieve what I wanted:

Board 1 – Input
Board 2 – Sequencer
Board 3 – Sum Register 1
Board 4 – Sum Register 2
Board 5 – Carry Register
Board 6 – 1-Bit ALU

Here’s how it should work.

You input your numbers in binary on the top two rows of the Input board (the first board). Each row supports up to 10-bits, which means any number from 0 to 1023. Then you press the little button and it spits out the answer on the bottom row of LEDs. There are 11 LEDs, so it’ll display an answer up to 2,047 (which is 1023+1023).

When you push the button, the Sequencer (the 2nd board) starts stepping through each of the 10 bits one by one all the way to the end.

When the Sequencer steps through a bit, it sends 5V into the corresponding bit for the first and second number. If the switch is on, that 5V bit is sent to the 1-bit ALU (the last board).

The 1-bit ALU takes the input from the two numbers as well as a carry if there is one and outputs the sum into one of the two Sum Registers (the 3rd or 4th board) and outputs the carry into the Carry Register (the 5th board) for use on the next bit. The LEDs on the bottom just show the contents of the two Sum Registers, which is subsequently, the answer to the math problem.

It sounds ridiculous and as you’ve already seen, it is completely ridiculous. So, where did the PCBs come from? Well, I made them! I drew up the design itself in a program called DesignSpark PCB. I then exported each board into a Gerber file. Those Gerber files were then imported into a program called FlatCam to create G-Code, which our old Bridgeport 3-axis CNC mill, which is massively oversized for this job, can run.

Once I had all the boards cut, I soldered on all the necessary components. In total: 90 relays, 96 diodes, 22 capacitors, 32 resistors, 32 LEDs, 21 switches and 1 button.

Then, it was just a matter of connecting them all together. I designed in a hole for a long piece of all-thread to go through with nuts, washers, lock washers and spacers to properly space the boards out and hold them in place. Then, I ran individual wires through each board to allow data to be sent back and forth from board to board. This is the result.

And here’s the video of me operating it one more time (so you don’t have to scroll back up to the top to watch it again).

Despite how long this post is, there’s actually a ton of fundamental stuff I left out regarding building computers and understanding how they work, but hopefully I can spark a little fire for knowledge in you and Ben Eater’s fantastic videos can help fan the flames!

Also, I’m still very much so a beginner at all this, so there are many inefficiencies and mistakes in my design. In actuality, I run into a bit of a power draw problem when I have certain numbers that require most of the LEDs to be illuminated, which causes some issues with the Sum Registers storing properly. So, it’s very much so a learning process for me as well!

Thanks for sticking with me through this non-automotive post!

1973 Isuzu Bellett: Refresh

As you all know, I absolutely adore driving my Bellett like a complete hoon. She’s not fast, pulling 0-100 km/h in about 13 seconds, but she’s one of the most hilariously fun cars I’ve ever owned. But, she’s still more than 45 years old, which means things break. As of late, the carburetors were begging for a clean (which makes sense because I stupidly don’t run a fuel filter) and the brakes were feeling atrocious – pulling hard to the right with a spongy pedal. On top of the that, the springs in the driver seat bottom had given way, giving me a terrible backache if I drove the car for too long. So, I knew it was time for a refresh, but I was putting it off and putting it off because I had other projects I was in the middle of.

What finally made me decide to start the overall refresh was the picture above. After searching on and off for a few years, that set of carbs and manifold showed up on Yahoo Auctions and I jumped on it. Finding a pair of Mikuni Solex 40 PHH carbs isn’t all that rare in and of itself, but finding them attached to a manifold for the G180SS engine is super rare. Once I finally got the carbs back to the US, I pulled the Bellett into the garage and got to work.

Not wanting to have a massive clutch fan obscuring the sweet, sweet noise of those Mikuni carbs, I took the opportunity to change over to an electric cooling fan as well. Which meant it was time to clean up some wiring in the engine bay. First, I built a panel that would hold two relays wired up to two 10A circuit breakers (instead of fuses) to run the e-fan and electric fuel pump. This panel would mount just below the battery and tuck nicely out of the way.

A lick of paint and she looks good installed!

Next up it was time to address the electric fan. I built these two x-brackets to hold the electric fan in place using the radiator mounting bolts.

I’ll show a picture of it installed a little later, but I don’t want to spoil the carbies just yet! While we’re on the topic of electronics, there was one more little problem I wanted to deal with. The alternator was woefully underpowered and would struggle to keep up with the fogs, headlights and high-beams on all at once. Throw in an electric fan and I was afraid I’d overtax it. Fortunately, since I’m in the middle of a Miata engine swap on the 117 Coupe, I had a spare alternator hanging around that was about a 15A upgrade. It didn’t mount up super easy peasy though. First, I had to figure out the wiring, which after a bit research led me to making this guide:

The space between the mounts was about 6mm too small for the alternator to slide onto the Bellett mount. So, after a lot of measuring, I found that the distance from the inside of the front mount to the center of the belt was the same between the two alternators, which meant all I had to do was chop about 6mm off the back mount. It had plenty of meat on it and I had a milling machine at my disposal, so chop chop and it fit perfectly! Just like the e-fan though, I’ll point that out after I get to the carbies.

Which I guess I should go ahead and show! Before cleaning anything up, I went ahead and slid them on to the engine just to make sure I could indeed make these work. Everything seemed to line up pretty well, so off they came and I stripped them completely.

While stripped, I cleaned up the body and manifold to make them look brand new. Then, a full rebuild kit went into the carb and on it went! Only, it didn’t. The manifold fought me tooth and nail the entire time. There must have been some subtle differences between the engine this manifold was designed for and my engine. It was still clearly for an Isuzu G-series counterflow head engine, but some of the tabs were off just enough to make it a bear to install. After some shaving here, grinding there, swearing over there, it finally slipped on and bolted down.

Even with just one carb clean, it looked absolutely brilliant! I set about rebuilding and cleaning up the remaining carb and tossed it on as well. Then, I had to do a few supporting mods to make sure the engine could keep up with the carbs. First, was a fuel filter. I ordered an SA22C RX7 fuel filter and clamp sized specifically for it, then made a little bracket and bolted it in place.

Next up was the ignition. I wanted to upgrade to a point-less type ignition, but you can’t exactly order an Isuzu Bellett conversion. Fortunately, after popping the distributor cap off and taking a look at the points, I could see they were actually a set of Nissan points.

After some hunting, I came across the Hot Spark 3HIT4U1, specifically for Japanese made Hitachi 4-cylinder distributors. After a bit of measuring, it was a perfect fit. I don’t have a picture of it installed, but check out their website linked above for more info.

With the ignition and fuel sorted, it was time to start buttoning up the engine bay!

Good god they look amazing! Other things to note in those two pictures are the 117 Coupe alternator installed just below the carbs and the electric fan tucked up against the radiator. Also, a little harder to see is a completely new ground cable that ties into the chassis at three different points along with the engine. With the carbs installed, it was time to give the old girl a start.

Yeah, that’s amazing! The throttle response is out of this World and the engine seems so much more lively than it ever did on the SUs. And keep in mind, in that video I have done zero tuning on the carbs. However, I can’t run it too long because the exhaust fumes would kill me and there’s still a lot of problems to take care of before I can move the car outside. First up, is the brakes.

After taking the front calipers off and taking a look at the caliper pistons, one major problem was immediately evident. They were so rusted and pitted, it was a miracle they even built pressure at all. Again, it’s not like I can just order new pistons, so it was time to get creative. First up, measure.

Even in those measuring pictures you can see how pitted they were, and I used the cleanest piston I had to get accurate measurements. After a ton of searching on the internet, I discovered there was nothing out there even remotely close that could work. So, I was left with essentially two options. Make new pistons or swap to different calipers. While mulling it over (and even holding an S30 caliper up to see if I could make it work), I looked over at the lathe and got to brainstorming.

I didn’t need the right height, I could fix that on the lathe, all I really needed was the right diameter. And, as it turns out, 350Z base model, single piston calipers use the same diameter. I ordered four seal kits and brake pistons for the 350Z (two pistons per caliper on the Bellett). They were obviously about two times too tall, but that can be fixed with carbide bits. On my first test, I destroyed the piston, which was expected, but I wasn’t smart enough to order spares. I then promptly ordered spares. My next trial was a total success, as seen in the picture above. The piston on the left is the 350Z piston, the piston on the right is the stock piston, the piston in the middle is my modified 350Z piston. The next attempt after that destroyed another piston. I was having difficulty because even though all the pistons I ordered were from the same manufacturer and for the same car, it turns out they were made of different materials. Some cut super easy, some were a right pain. Finally, after about eight pistons in total, I came up with four that would work.

I decided to get the rotors turned as well, which required pulling the hubs off. I’m not sure what wheel bearing grease I used when I built the car, but it was the wrong type of grease. The grease had turned black and wasn’t doing its duties as grease. Time for new wheel bearings too. With those ordered and installed, I put the whole brake system back together and started the arduous process of bleeding.

Unfortunately, it just wouldn’t build pressure. You’d give the pedal a few pumps and it’d firm right up, but wait 10 seconds and the pedal would go right to the floor again. I thought I was just crap at bleeding and went through two full bottles of brake fluid trying to get it to bleed, but it just wouldn’t. I figured it had to be a bunk master cylinder, so, out it came. Interestingly, when I built the car about 10 years ago, you could still get new master cylinders, and this was a new Isuzu part. But after dismantling it, I could see it was leaking pretty profusely.

A brand new master cylinder kicking it in under ten years is just… frustrating. Not wanting to go through the rigamarole of trying to get another new one from Isuzu Japan and get it shipped here, if they even still had any, I decided to start the hunt for something could work. After a couple trials and errors, I settled on a proper racing brake master cylinder from Tilton.

Unfortunately, this isn’t a dual master cylinder, so the entire brake system is now on a single circuit. Which means if I get a leak, the entire system loses pressure. That’s why they call it an “emergency” brake, right? The upside is that it was almost a direct bolt-in upgrade. I had to enlarge the mounting holes on the Tilton master by 1.5mm and I had to remake a few of the nasty Bellett hardlines, but that was it. I even was able to reuse the Bellett push-rod. Also, I bumped up in master cylinder bore diameter from the 3/4” of the stock master to 7/8” on the Tilton. This should give a firmer pedal that I can really lean into.

And boy did it deliver! After a single round of bleeding the pedal was the most affirming and brilliant brake pedal I’ve ever felt in this car! Before we could go for serious test drives though, there were still a few more things to tackle. First, the seat.

I ordered this OMP Silverstone seat slightly used off eBay and ordered an OMP seat rail off Amazon. Interestingly, the factory Bellett seat mounting holes were so close to the OMP seat, that all I had to was enlarge the Bellett holes by about 3 mm and the seat bolted right up. It’s super weird that I’m having better luck with bolt-ons for a car from the 70s than I ever had on cars from the 80s and 90s!

It is super comfortable! I would prefer for it to drop down about another half-inch and slide back another 2 inches or so, but that would require a fairly large amount of cutting on the Bellett. So, we’ll drive it like this for a while and see how I like it.

Some of the more astute viewers may notice in those seat pictures that I’m missing a shift lever. Let me tell you a story about how I’m an idiot sometimes. While working on the car, I noticed that there was an alarmingly large puddle of trans fluid forming underneath it. After climbing around I could see that it was coming from where the speedo cable goes into the trans. Not too surprising, the speedo has been having trouble for a while now and a shot cable was on my list of suspects. After some research, I think I’ll change over to a GPS box that spins an electric motor with a short cable to turn the original speedo, eliminating the need for a new cable. I pulled the old cable out, and dumbly didn’t realize that it was below the fill line of the transmission. A ton of fluid came out, dropping the transmission fill level to about half. Okay, that’s a problem for future David, first, let’s make a plug for the speedo hole.

God, I love having a lathe in the shop. I popped my new plug in, tightened it down and set about refilling the transmission with fluid. Except, I couldn’t get the fill plug out. Throughout the years it had been stripped, broken and beat to hell, and I remember the last time I filled the transmission that I hoped I never had to fill it again. It was so stripped I could not crack it loose, and with the transmission tunnel in the way, there was no space to get vice grips or anything on it. So, I started looking for other potential places to fill from. I tried dropping the drive shaft and filling from there, but that was a no go. Then I noticed just above the fill spot there was a small bolt holding a plug in place. “Sweet, it’ll overfill, but I’ll just be careful” I thought. I undid the bolt, slid the plug out and promptly discovered that it wasn’t a plug at all, but rather a pin for the shift linkage. Hmmm, that meant there was only one direction to go from here:

Yup, transmission out. Fortunately, the shift linkage was all on top and easy to access once out of the car. With the pin back in place, I ripped that crappy fill plug out.

It was properly gone. I measured it up and ordered a new one, so now I won’t have this problem again hopefully. While I was messing about with the shift linkage, I decided to address the sloppy shifter. Upon closer inspection, it was clearly sloppy because the original bushing had exploded into a million tiny pieces. Welp, time to spin that lathe up again.

Transmission got thrown back in, shifter with new bushing thrown in, and the whole car buttoned up. It was time for a proper test drive. My God it’s a different animal. After some idle tuning and playing with ignition timing, I’ve got it set pretty close. The jetting on the carbs feels pretty close too and the plugs look good, but I need to get a proper tune done on a dyno to make sure I’m not leaning out anywhere. The brake feel absolutely amazing, they’re the best feeling brakes of any car I’ve ever owned. Thank you Tilton! The seat is ultra comfy with fantastic support. The fan kicks on when it’s supposed to and keeps engine temps perfectly in check. It’s just an absolutely wonderful car to drive now!

Here’s the “Too Long, Didn’t Read” list of all the changes that went down:

New Mikni Solex 40 PHH carbs and manifold
New electronic ignition
New fuel filter (from SA22C)
Upgraded alternator (taken from 117 Coupe)
Electric fan (with thermo switch in bottom radiator hose)
New breaker and relay panel for e-fan and fuel pump
Tilton brake master cylinder
Modified 350Z brake pistons to fit Bellett calipers
Turned brake rotors
New wheel bearings
New OMP Silverstone seat
New shift bushing

Thank for reading!

1973 Isuzu Bellett: Repair Manual

Download it here: PR90 FSM (346 downloads)

This is something that has been a massive help while working on my Bellett! Although, it’s not specifically for the 1800GT, it has gotten me headed in the right direction many a time.

Download it here: PR90 FSM (346 downloads)

Hopefully this can help someone out there trying to keep these beautiful machines on the road!

1991 Honda Beat: DFW Kei Car Meetup

My two Kei car brethren from the Magazine shoot we did at the end of last year have a mutual friend who recently got his hands on a Suzuki Alto Works RS/X. And, he knew another gentleman with a heavily modified Alto Works, so they asked if I wanted to come on up to Dallas for a Kei car meetup!

I, of course, said absolutely, because it sounded like a good time, but it was also serendipitous because I just got my hands on a DJI Osmo Mobile 2 smartphone gimbal, and I wanted to give it a real World test. Also, it was a great chance to meet a fellow online acquaintance who had recently moved to the area from Canada with his utterly awesome Autozam AZ-1.

I only took a little bit of video and the low light conditions were playing havoc with my phone camera, but the result isn’t bad! Check the quick music video I put together below!

Also, check out the Usagi Motors YouTube channel for more videos: https://www.youtube.com/c/UsagiMotors