Jump to content

Discrete D Flip Flop circuit using BiCMOS

Making your own processor is a bucket list project for many electronic enthusiasts. At the heart of any digital system there are two parts:

  • Logic gates
  • Latches

A cpu can be designed using a description language such as VHDL, which can be synthesized into an actual schematic with logic gates and latches. Usually this is then implemented on an FPGA, but it is totally possible to built it using discrete components, which has been achieved multiple times (such as the monster 6502). The biggest constraint is the number of components, thus it makes sense to spend a lot of time on perfecting a latch structure that uses as few components as possible. The most commonly used structure for discrete latches is a set/reset latch with enable. Putting two in series with opposite clock polarity forms a master/slave flip flop.

 

image.png.b46c2e703766fe72ad0cba67e4b8c0c4.png

 

This topology uses 5 transistors per latch, so 10 per master/slave flip flop. Can we do better?

 

Quick note: some structures exist with less components by using capacitors to detect the rising edge or create delays, which limits the maximum frequency. This is not the most elegant solution.

 

Aside from two transistors whose gates are crossed, I only found one other latching structure found in power electronics: the thyristor. A thyristor acts like a diode with a trigger, which turns on by injecting a small gate current and will stay on even after the gate is released until the current goes to zero. My first idea to turn a thyristor in a functional latch with enable was this:

 

271320704_Capturedu2022-11-1811-05-18.png.9bf6f5f20074b665c292af85ac49852a.png

 

The latching branch with the thyristor is switched off when the clock goes low, and memorizes the data when the clock is high. This doesn't work in practice as the injected current in the gate is cut off too fast to enable the SCR circuit to turn on. After a lot of trial and error I managed to get a working DFF structure, which is by no means perfect nor elegant, but functional (I tested 3 D flip flips in series and inverted the last one to make a Johnson counter):

 

image.png.c3a8f166a9f76d889143f49ffb6151d1.png

 

latch_counter_1.PNG.72342f191180584ae3dd042cd3393c17.PNG

 

Even though the initial goal of reducing the component count is not yet achieved, I think this circuit has a lot of room for improvement and that some optimization can be done. Please let me know if you have some ideas to perfect this design!

 

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, that_dude said:

Just looking at the last schematic: I would be nervous if a basic current mirror does the job especilly without bypassing/filtering. At the end of the day is this discrete logic with real world problems the simulation won't simulate.

Usually spice models are quite accurate and takes into account hundreds of not thousands of the transistor imperfections. That said I didn't test the circuit on a breadboard yet so there might be some behaviour that the simulation doesn't show for sure. For instance the tracks in the simulation are ideal whereas those on a breadboard feature parasitic impedances.

Link to comment
Share on other sites

Link to post
Share on other sites

21 hours ago, Aranwe said:

Usually spice models are quite accurate and takes into account hundreds of not thousands of the transistor imperfections. That said I didn't test the circuit on a breadboard yet so there might be some behaviour that the simulation doesn't show for sure. For instance the tracks in the simulation are ideal whereas those on a breadboard feature parasitic impedances.

Before I actually spend a long time analysing and commenting on this, do you know how spice works? If not, please read up on it before trusting it with simulations like this. It depends on the model and which spice variant you're using. But even then you got to be careful with SPICE since it can hide sneaky design instabilities, and I find it often misjudges the realistic high speed performance of discrete transistors.

 

In any case, if you're planning to build this as a discrete circuit, it's not going to work because you'll never get that many transistors to match, a big part of making a mirror is getting matched transistors at the same temperature.

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, ImorallySourcedElectrons said:

Before I actually spend a long time analysing and commenting on this, do you know how spice works? If not, please read up on it before trusting it with simulations like this. It depends on the model and which spice variant you're using. But even then you got to be careful with SPICE since it can hide sneaky design instabilities, and I find it often misjudges the realistic high speed performance of discrete transistors.

Thanks for your feedback! Even though I got a "working" simulation, I agree that it doesn't guarantee by any means that it will work with real components. That's why I'm looking for improvements and other ideas 🙃 Don't latching circuits work at all thanks to transistor imperfections? 🤔 Edge triggered circuits take advantage of propagation delays ; too much of a delay and the signal can propagate through several gates at a time, but too small of a delay and it won't have time to latch at all.

7 minutes ago, ImorallySourcedElectrons said:

In any case, if you're planning to build this as a discrete circuit, it's not going to work because you'll never get that many transistors to match, a big part of making a mirror is getting matched transistors at the same temperature.

When I get to a more refined design I could perform a Monte Carlo simulation to see if disparities in the components values will affect the circuit. This won't replace real world testing either, but it could help bringing up problems before making a test circuit.

 

Do you know any other topology to make a latch using as few components as possible?

 

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah, though some also make use of the inherent capacitance or limited bandwidth of certain circuit elements, which smells a lot like propagation delay but is slightly different. But it's a bit of a conundrum, you can always go for the really simple RTL two transistor memory cell, but then you instantly have four - five transistors if you want it to be usable, and then when you want it to behave properly and you already have six, then you want to up the speed by not driving the transistors into saturation, etc. It's all a bit fudgy sometimes.

 

If you need some inspiration, try"Digital Integrated Electronics" by Herbert Taub and Donald Schilling. It's an old book, but it shows some practical schematics on how you might design these things. But there's no real way to reliably go below 6 transistors with a discrete mosfet-based flip flop I think, if you want it to behave as a proper flip-flop you need a few more, so ten ain't unreasonable. If you're planning to make a ram bank you could go for dynamic memory and cut down on transistors a lot, but then you have to design a memory controller which is a whole headache of its own. As to using monte-carlo simulations, that's definitely worth doing. Just remember that the feature in some spice variants (e.g., LTSpice) that takes the min-max of each value isn't guaranteed to hit the worst-case scenario. Depending on how paranoid you are you want to use a uniform distribution to check for the effect of your component value spread.

 

And if you're up for some "cheating" to get the number of solder joints down, you can always look into making latches with an opamp or comparator though. I've had to do that a few times in radiation-hardened designs where regular flip-flops are generally not available. If you do it right you can make quite reliable and simple latches, just be sure to not use one with an open-collector output like I had to do. *Walks away grumbling and cursing about LM139s.*

 

Link to comment
Share on other sites

Link to post
Share on other sites

24 minutes ago, that_dude said:

Multiple transistors on a single die/package are avaible. Normally they are reasonably matched and all at the same temperature.

Ideally, yes, but they've become quite difficult to source in recent years beyond dual transistors per package. You can still get the 3904 quad arrays quite easily, but they tend to run upwards of €3 / chip. There are also a few MOSFET ones, but they've also gone the way of the discrete OTA: spotty availability. We've been avoiding them in designs as a result of that. But if you manage to find some for a reasonable price they're definitely an option. But best to first check if they're actually matched, there've been some funny folks who bond 4 individual dies on a lead-frame.

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, ImorallySourcedElectrons said:

But best to first check if they're actually matched, there've been some funny folks who bond 4 individual dies on a lead-frame.

 

I am sorry to go a little off topic. Are there some easy way to spot those? Or do you really need to measure all transistors inside?

I am asking, because i regularly need different types of those for repair purposes.

Link to comment
Share on other sites

Link to post
Share on other sites

49 minutes ago, Heats with Nvidia said:

I am sorry to go a little off topic. Are there some easy way to spot those? Or do you really need to measure all transistors inside?

I am asking, because i regularly need different types of those for repair purposes.

Shouldn't be an issue if you source through something like Digikey, Farnell, etc. Just avoid aliexpress and eBay.

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, Heats with Nvidia said:

I am sorry to go a little off topic. Are there some easy way to spot those? Or do you really need to measure all transistors inside?

I am asking, because i regularly need different types of those for repair purposes.

For a lot of components there are several variants with different tolerances. Usually the highest bin also has the best tolerances because they physically come from the middle of the silicon wafer where the yields are the best and the process the most uniform.

 

Also if you buy entire reels you can assume that all the components on that reel are very very close to one another. So if you repair something and it works, you know your whole batch will work too.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Aranwe said:

For a lot of components there are several variants with different tolerances. Usually the highest bin also has the best tolerances because they physically come from the middle of the silicon wafer where the yields are the best and the process the most uniform.

 

Also if you buy entire reels you can assume that all the components on that reel are very very close to one another. So if you repair something and it works, you know your whole batch will work too.

 

26 minutes ago, that_dude said:

For the multiple die: Sandpaper and work through the package until you hit the silicon.

If you do it frequently invest in a fumehood, magnetic stirrer and fuming nitric acid. Also don't use gloves or understand which type is safe as some materials catch fire.

 

Matched? Measuring it.

Thank you for these ideas, but when i repair, i need one or two of them. And a couple of weeks later, i need another type and so on.

I usually buy ten of them, so i have them around, when i need them again. Doing all these tests will take more time and money than the actual repair. The problem is, i don`t repair one type of device from one manufacturer. Its the total opposite, there are only a couple of devices that i see more than once a month. So i will have to trust my supplier, and test, if something doesn`t work as intended.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Heats with Nvidia said:

 

Thank you for these ideas, but when i repair, i need one or two of them. And a couple of weeks later, i need another type and so on.

I usually buy ten of them, so i have them around, when i need them again. Doing all these tests will take more time and money than the actual repair. The problem is, i don`t repair one type of device from one manufacturer. Its the total opposite, there are only a couple of devices that i see more than once a month. So i will have to trust my supplier, and test, if something doesn`t work as intended.

It's honestly not a big issue unless if you order from AliExpress or eBay. It's a bigger issue if you have local buyers in China trying to scrape every cent off a volume order.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×