Re:How Flip-flops are implemented in the Intel 8086 processor
by kens on Saturday September 30, 2023 @12:28PM
(#37717022)
Author here for all your 8086 questions :-)
By the way, HN's title editing makes the title appear a bit strange. Of course flip-flops are implemented in the processor. The article describes how they are implemented.
Re:How Flip-flops are implemented in the Intel 8086 processor
by mochomocha on Saturday September 30, 2023 @02:40PM
(#37718430)
I just wanted to express gratitude for the amazing work you're doing. As someone with no hardware background, I learnt a lot from reading your blog, and I marvel at the amount of collective human intelligence packed into all the tiny chips surrounding our daily lives.
Re:How Flip-flops are implemented in the Intel 8086 processor
by phkahler on Saturday September 30, 2023 @04:00PM
(#37719179)
I've toyed with the idea of a flip-flop that captures the input on both rising and falling edges. Doing this at the gate level seems inefficient, so I've wondered if there is a better way to design it, and if anyone uses such a thing in production. What do you think?
Re:How Flip-flops are implemented in the Intel 8086 processor
by denotational on Saturday September 30, 2023 @01:40PM
(#37717823)
> However, the enable input is a fairly obscure feature for a flip-flop component; most flip-flop chips have a clock input, but not an enable.
The clock-enable is actually really common for flops in an integrated circuit, and it sees heavy use; it might have been unusual in the days of discrete TTL logic, but as the article concedes, practically every cell library or FPGA fabric you can find will have it.
The CE functionality is used heavily by the synthesis/technology-mapping process, indeed any time you write an `if` without an `else` within a clock-edge sensitive process, the tool is probably going to use a CE.
Re:How Flip-flops are implemented in the Intel 8086 processor
by denotational on Saturday September 30, 2023 @02:50PM
(#37718517)
I pretty much only work with Xilinx/AMD parts these days, and, at least on US/US+, they do indeed all have a CE on all the flops (unless there are undocumented degenerate cells with missing features).
Re:How Flip-flops are implemented in the Intel 8086 processor
by jecel on Thursday October 05, 2023 @04:05PM
(#37783608)
There is a design style called RTL (register transfer level) which works better with registers that have separate clock and enable inputs. The clock goes to all registers, but on any given cycle only a subset of those are enabled depending on the current state. Since these enables are generated from the outputs of these registers which then pass through some combinational logic, they will be stable around the rising edge of the clock.
Note that people talk about Verilog or VHDL as "RTL languages". That is not correct - these languages allow hardware designs using any style to be modeled. But sticking with RTL is strongly encouraged. A design that uses the output from one part of a circuit as a clock to another part, for example, is not RTL. This might cause problems when moving from one FPGA to another or to an ASIC.
Re:How Flip-flops are implemented in the Intel 8086 processor
by jhallenworld on Saturday September 30, 2023 @11:42PM
(#37722333)
There were a few TTL ones available: 74x378 is one I used back in the day. It was easier to meet timing with parts like this. I used it for my PCI cards: it was part of a circuit that latched the address of PCI configuration writes- the only data that would make it to the board if the transaction times out. Why did I need this? To load the bits into Xilinx 4010E FPGA which held the full PCI interface, thereby avoiding the need for a Xilinx configuration PROM. After the design was loaded, the PCI interface would come alive and start responding to transactions.
This worked until Intel decided to save power by disabling the PCI clock on unused sockets: it means your device had better exist on the bus before the BIOS's PCI enumeration (actually this is not true- with the full bridge documentation I could enable the clock- but I didn't have it, and in any case, then the design would be chipset dependent).
Re:How Flip-flops are implemented in the Intel 8086 processor
by dekhn on Saturday September 30, 2023 @02:27PM
(#37718314)
All digital logic is fundamentally analog.
No, the TPU is not async. It has a single main clock. It does work in parallel, but it's still synchronously clocked. As neat as async is, it's truly a paradigm shift that affects nearly everything about your system and most of us can'd think in partial differential equations.
Re:How Flip-flops are implemented in the Intel 8086 processor
by kens on Saturday September 30, 2023 @02:35PM
(#37718381)
One of Vonada's 14 engineering maxims is "Digital circuits are made from analog parts." That said, dynamic logic that depends on capacitance is more analog than most digital logic :-)
Re:How Flip-flops are implemented in the Intel 8086 processor
by dekhn on Saturday September 30, 2023 @03:45PM
(#37719029)
OK I learned a bit today- I didn't realize transistors were considered "active", or that dynamic logic was uncommon.
Vonada's engineering maxims are pretty scary to me- an amateur hobbyist soldering various chips together to build simple projects like "a rotary encoding controlling a binary counter visualized with LEDs". I spend many hours soldering and carefully debugging every individual component, and when I integrate, spend many more hours debugging why something doesn't work. The failures are almost always because I did something dumb, like wiring up VCC and GND backward, I honestly don't know that I'd be able to debug "When all but one wire in a group of wires switch, that one will switch also." in my binary counter's inputs or outputs.
Re:How Flip-flops are implemented in the Intel 8086 processor
by tzs on Saturday September 30, 2023 @05:07PM
(#37719818)
> Vonada's engineering maxims are pretty scary to me- an amateur hobbyist soldering various chips together to build simple projects like "a rotary encoding controlling a binary counter visualized with LEDs"
Fortunately for probably most hobby projects you don't have to worry about most of those things.
A lot of those maxims concern failures of the lumped element model.
The lumped element model is a model where all the capacitance occurs in capacitors, all the resistance is in resistors, all the inductance is in inductors, and so on, and wires are zero resistance conductors of current that do not couple magnetically or inductively with anything.
If clock speeds aren't too high, there is enough gap between the highest 0 logic voltage and the lowest 1 logic voltage, wires aren't too long, voltages and currents aren't too high or too low, and you don't do anything like put loops in your wires (other than when you are intentionally trying to make an inductor) the deviations of reality from the lumped element model shouldn't cause any problems.
As you deal with higher frequencies reality starts to noticeably diverge from the lumped element model. You have to start worrying about things like capacitance between leads on your components, inductance between wires, and wires acting like transmission lines.
Keep going up in frequency and you can get to a point where you have to use software that can solve (exactly or numerically) Maxwell's equations for the fields around things and take into account interactions with those fields.
Hobbyist projects can do things that get past where the lumped element model is all you need, such as WiFi or Bluetooth which operate at several GHz, but usually those functions are handled by modules that the hobbyist buys that are (hopefully!) designed by people who know how to deal with high frequencies. E.g., you buy an RF module that does the scary radio stuff, and you control it from a microcontroller that is running an order of magnitude or more slower than the RF module, and whatever inputs and sensors and non-radio outputs you have are probably at least an order of magnitude slower than your microcontroller.
Those non-RF parts of the project are likely to be well in the realm where lumped element works.
Most of the rest of the maxims concern things that are mostly going to be a problem for big projects where you might be worrying about things like synchronizing things across dozens of subsystems and with very tight tolerances.
Re:How Flip-flops are implemented in the Intel 8086 processor
by dfox on Saturday September 30, 2023 @05:35PM
(#37720091)
In digital circuits the “frequency” when the lumped model breaks down is determined by the slew-rate (ie. spectral content of the edges), not the bitrate/clock frequency. In the electronics hobbyist community there are many cases when you can run into that issue head first while just connecting modules together (because the whatever IC on the module has significantly faster slew-rate than you need). Another example are MCUs with somewhat high internal clock rates and their power requirements, even 20-ish year old dsPIC requires somewhat involved supply decoupling topology to work at all (and the quality of decoupling for ESP32 has direct effect on signal quality and how much of RF noise it spews out).
Re:How Flip-flops are implemented in the Intel 8086 processor
by dekhn on Saturday September 30, 2023 @08:23PM
(#37721300)
The one situation where this seems to come up is that I'm using PWM duty cycle to control a constant current LED driver. Because my light is far too bright at full intensity, the driver has a PWM pin that lets attenuate that. however, because I'm taking extremely fast images (sub-millisecond exposures), if I use a low PWM frequency (<1MHz) I see image artifacts. I am trying 1MHz PWM (generated by my arduino) on a solderless breadboard, and I see flaky behavior when I increase the PWM beyond 250KHz or so. Things look fine on my scope, but the LED itself often doesn't behave as expected.
Re:How Flip-flops are implemented in the Intel 8086 processor
by dfox on Saturday September 30, 2023 @05:22PM
(#37719957)
> I honestly don't know that I'd be able to debug "When all but one wire in a group of wires switch, that one will switch also." in my binary counter's inputs or outputs.
The intention of the maxim is to design the system in a such way that the all-but-one situation never happens. And if it has to happen then you need to be sure that the “analog stuff” and “black magic” like power supply decoupling and ground return paths is handled correctly.
And in fact the binary counter is perfect example for that. You can design that as an ripple counter or synchronous counter. Ripple counter is simpler and does not suffer from these kind of issues because the switching ripples through the bits LSB to HSB, which also means that there is a period of time before the output stabilizes where it is simply wrong, which is the main drawback of that design.
Re:How Flip-flops are implemented in the Intel 8086 processor
by SomeoneFromCA on Saturday September 30, 2023 @03:06PM
(#37718673)
No one argues, that digital logic is indeed analoh, however you rarely see reliance on a passive element (in analog sense), to be "active" in a digital sense. DRAM is the only widely known example.
Re:How Flip-flops are implemented in the Intel 8086 processor
by dreamcompiler on Saturday September 30, 2023 @03:34PM
(#37718935)
It's only because capacitors let you use fewer transistors. Any effort to shrink memory cells as much as possible inevitably leads to a capacitor-transistor hybrid solution.
In logic circuits class they don't talk about areal constraints, but IC designers have to think about such things.
Re:How Flip-flops are implemented in the Intel 8086 processor
by duskwuff on Saturday September 30, 2023 @05:05PM
(#37719811)
> you rarely see reliance on a passive element (in analog sense), to be "active" in a digital sense
This technique is referred to as "dynamic logic". It was common in the early days of MOS ICs -- for instance, it was used extensively in the original 6502 -- and still finds some usage in high-performance ICs.
Re:How Flip-flops are implemented in the Intel 8086 processor
by hasmanean on Saturday September 30, 2023 @10:39PM
(#37722034)
Well using analog effects in digital logic has its risks…at relativistic speeds the capacitor dimensions will change, altering capacitance. Depending on the direction of travel, it could go up or down. ;)
Re:How Flip-flops are implemented in the Intel 8086 processor
by Tuna-Fish on Saturday September 30, 2023 @05:10PM
(#37719845)
Nobody designs async things anymore, because they are much harder to validate, partly because there is no async equivalent of all the tooling used to validate synchronous logic. The final product might be better, but if it takes 3 years longer to ship because validation is harder, there is no room for it in the market. (Because the synchronous competitor has already shipped their next version on a better process node by the time you get yours out.)
Re:How Flip-flops are implemented in the Intel 8086 processor
by jiggawatts on Saturday September 30, 2023 @07:15PM
(#37720888)
Maybe that was a valid rule of thumb for decades that everyone internalised as a hard rule… but recent process changes haven’t delivered anywhere near the giant leaps that they used to.
Maybe now it would be worth revisiting, especially since we can throw so much computer power at validation!
Re:How Flip-flops are implemented in the Intel 8086 processor
by jhallenworld on Saturday September 30, 2023 @11:51PM
(#37722367)
So at the opposite end of the speed spectrum, you might enjoy my relay computer: it uses a capacitor for the master part of the flip-flop for exactly the same reason- to save on the number of active components. See:
By the way, HN's title editing makes the title appear a bit strange. Of course flip-flops are implemented in the processor. The article describes how they are implemented.
I feel inside-the-sausage-factory enlightenment. Which practically speaking might be the best kind I will experience. Thank you.
It changed my mental model. And the new model is less complicated.
The clock-enable is actually really common for flops in an integrated circuit, and it sees heavy use; it might have been unusual in the days of discrete TTL logic, but as the article concedes, practically every cell library or FPGA fabric you can find will have it.
The CE functionality is used heavily by the synthesis/technology-mapping process, indeed any time you write an `if` without an `else` within a clock-edge sensitive process, the tool is probably going to use a CE.
Note that people talk about Verilog or VHDL as "RTL languages". That is not correct - these languages allow hardware designs using any style to be modeled. But sticking with RTL is strongly encouraged. A design that uses the output from one part of a circuit as a clock to another part, for example, is not RTL. This might cause problems when moving from one FPGA to another or to an ASIC.
This worked until Intel decided to save power by disabling the PCI clock on unused sockets: it means your device had better exist on the bus before the BIOS's PCI enumeration (actually this is not true- with the full bridge documentation I could enable the clock- but I didn't have it, and in any case, then the design would be chipset dependent).
1. Interesting, how fundamentally analog element such as capacitor, find its way into dynamic logic circuits.
2. The article states that asynchronous computers are not made anymore. Is not google TPU asynchronous?
No, the TPU is not async. It has a single main clock. It does work in parallel, but it's still synchronously clocked. As neat as async is, it's truly a paradigm shift that affects nearly everything about your system and most of us can'd think in partial differential equations.
Vonada's engineering maxims: https://twitter.com/kenshirriff/status/1633154548318732289
Vonada's engineering maxims are pretty scary to me- an amateur hobbyist soldering various chips together to build simple projects like "a rotary encoding controlling a binary counter visualized with LEDs". I spend many hours soldering and carefully debugging every individual component, and when I integrate, spend many more hours debugging why something doesn't work. The failures are almost always because I did something dumb, like wiring up VCC and GND backward, I honestly don't know that I'd be able to debug "When all but one wire in a group of wires switch, that one will switch also." in my binary counter's inputs or outputs.
Fortunately for probably most hobby projects you don't have to worry about most of those things.
A lot of those maxims concern failures of the lumped element model.
The lumped element model is a model where all the capacitance occurs in capacitors, all the resistance is in resistors, all the inductance is in inductors, and so on, and wires are zero resistance conductors of current that do not couple magnetically or inductively with anything.
If clock speeds aren't too high, there is enough gap between the highest 0 logic voltage and the lowest 1 logic voltage, wires aren't too long, voltages and currents aren't too high or too low, and you don't do anything like put loops in your wires (other than when you are intentionally trying to make an inductor) the deviations of reality from the lumped element model shouldn't cause any problems.
As you deal with higher frequencies reality starts to noticeably diverge from the lumped element model. You have to start worrying about things like capacitance between leads on your components, inductance between wires, and wires acting like transmission lines.
Keep going up in frequency and you can get to a point where you have to use software that can solve (exactly or numerically) Maxwell's equations for the fields around things and take into account interactions with those fields.
Hobbyist projects can do things that get past where the lumped element model is all you need, such as WiFi or Bluetooth which operate at several GHz, but usually those functions are handled by modules that the hobbyist buys that are (hopefully!) designed by people who know how to deal with high frequencies. E.g., you buy an RF module that does the scary radio stuff, and you control it from a microcontroller that is running an order of magnitude or more slower than the RF module, and whatever inputs and sensors and non-radio outputs you have are probably at least an order of magnitude slower than your microcontroller.
Those non-RF parts of the project are likely to be well in the realm where lumped element works.
Most of the rest of the maxims concern things that are mostly going to be a problem for big projects where you might be worrying about things like synchronizing things across dozens of subsystems and with very tight tolerances.
The intention of the maxim is to design the system in a such way that the all-but-one situation never happens. And if it has to happen then you need to be sure that the “analog stuff” and “black magic” like power supply decoupling and ground return paths is handled correctly.
And in fact the binary counter is perfect example for that. You can design that as an ripple counter or synchronous counter. Ripple counter is simpler and does not suffer from these kind of issues because the switching ripples through the bits LSB to HSB, which also means that there is a period of time before the output stabilizes where it is simply wrong, which is the main drawback of that design.
In logic circuits class they don't talk about areal constraints, but IC designers have to think about such things.
This technique is referred to as "dynamic logic". It was common in the early days of MOS ICs -- for instance, it was used extensively in the original 6502 -- and still finds some usage in high-performance ICs.
Maybe now it would be worth revisiting, especially since we can throw so much computer power at validation!
https://relaysbc.sourceforge.net/circuits.html#:~:text=Low%2...