Latest / CyberSecurity Summary / Architecting High-Performance Embedded Systems: Design and build high-performance real-time digital systems based on FPGAs
Transcript
- 0:00Speaker 1: Okay, so let's unpack this. It is Thursday, February twenty sixth,
- 0:04Speaker 1: twenty twenty six, and today we are going to look
- 0:08Speaker 1: at something that is literally all around.
- 0:10Speaker 2: You right now, well absolutely everywhere.
- 0:12Speaker 1: Yeah, Like it is probably on your mist it's definitely
- 0:15Speaker 1: in your pocket, it's in your car, and it might
- 0:17Speaker 1: even be in your toaster. But you never really.
- 0:19Speaker 2: See it, right, which is I mean, that's the mark
- 0:22Speaker 2: of a good design, right, If it's working perfectly, it's
- 0:25Speaker 2: completely invisible. It's kind of the dark matter of the
- 0:28Speaker 2: digital world.
- 0:29Speaker 1: The dark matter. I love that exactly. So we are
- 0:32Speaker 1: doing a deep dive today into the invisible digital infrastructure
- 0:36Speaker 1: that basically runs the modern world. We are talking about
- 0:39Speaker 1: embedded systems and to guide us through this absolute maze
- 0:43Speaker 1: of you know, wires and logic gates, we're doing a
- 0:47Speaker 1: deep dive into the source material here, which is the
- 0:50Speaker 1: book Architecting High Performance Embedded Systems by Jim Leaden.
- 0:53Speaker 2: It's a fantastic resource.
- 0:55Speaker 1: It really is. Now. I have to admit, when I
- 0:57Speaker 1: first saw the title, I thought, well, I thought, okay,
- 0:59Speaker 1: this is going to be a super dry technical manual.
- 1:02Speaker 2: Sure, yeah, it sounds like one.
- 1:03Speaker 1: Right, but it's actually a beast of a book. I
- 1:06Speaker 1: mean it covers everything from the literal physics of sensors
- 1:10Speaker 1: all the way up to computer chips that can basically
- 1:13Speaker 1: rewire themselves on the fly.
- 1:14Speaker 2: It is a comprehensive guide for sure. And what I
- 1:17Speaker 2: really appreciate about Lenins approaching this book is that he
- 1:21Speaker 2: doesn't just treat these systems as well as like small computers.
- 1:25Speaker 2: He really emphasizes the immense complexity and the precision that's
- 1:29Speaker 2: required to actually make them work. Because you know, unlike
- 1:33Speaker 2: your laptop, which just sits in a nice air conditioned
- 1:35Speaker 2: room or on your desk hopefully right, hopefully, these embedded
- 1:39Speaker 2: systems they live out in the real world there in
- 1:41Speaker 2: the mud, the heat, the freezing rain, and you know,
- 1:44Speaker 2: literally bolted inside exploding car engines.
- 1:47Speaker 1: Yeah, the environment is brutal. So let's start with the
- 1:49Speaker 1: basics for you listening, what actually counts as an embedded system?
- 1:52Speaker 1: Because I feel like that term gets thrown around a lot,
- 1:54Speaker 1: like I have a laptop, I have a smartphone, I
- 1:57Speaker 1: have a car. Are they all embedded system?
- 2:00Speaker 2: It's a really great question to start with. The core
- 2:03Speaker 2: definition Leaden gives is pretty specific. An embedded system is
- 2:07Speaker 2: digital processing that is integrated into a device that has
- 2:11Speaker 2: a larger purpose beyond just computing.
- 2:14Speaker 1: Well, okay, unpack that a bit, a larger purpose beyond computing.
- 2:17Speaker 2: Yeah, so think about your laptop. Its entire purpose is
- 2:20Speaker 2: to compute. It is a general purpose machine. Right. You
- 2:23Speaker 2: can use it to write a novel, you can edit
- 2:25Speaker 2: a video, you can calculate a giant spreadsheet. It's flexible.
- 2:29Speaker 2: But a car, a car's purpose is to move people
- 2:32Speaker 2: from point A to point B right to drive exactly.
- 2:35Speaker 2: The computers inside the car are just there to facilitate
- 2:39Speaker 2: that physical movement. They are specialists.
- 2:41Speaker 1: Okay, So the laptop is the jack of all trades
- 2:44Speaker 1: and the embedded system is the master of one.
- 2:46Speaker 2: Precisely, And Lettin uses a really great simple example to
- 2:50Speaker 2: draw the line here. He calls it the toothbrush test.
- 2:52Speaker 1: The toothbrush test. Okay, I love this. Break it down.
- 2:55Speaker 2: So take a standard electric toothbrush from say, maybe twenty
- 2:58Speaker 2: years ago. Bat a motor and the little physical switch
- 3:02Speaker 2: you turn it on, the circuit closes, the motor spins,
- 3:05Speaker 2: and you brush your teeth. Is that an embedded system.
- 3:08Speaker 1: I'm gonna guess. No, I mean it's just it's electric, right,
- 3:12Speaker 1: It's just mechanics and a battery.
- 3:14Speaker 2: Right. There is no digital processing happening. It's just dumb logic.
- 3:18Speaker 1: Right.
- 3:18Speaker 2: But take a modern smart toothbrush, the kind that lights
- 3:22Speaker 2: up red if you press too hard against your gums.
- 3:25Speaker 1: Oh yeah, I have one of those. It actively gets
- 3:27Speaker 1: angry at.
- 3:28Speaker 2: Me exactly, and that anger requires intelligence. It has a
- 3:32Speaker 2: physical sensor to measure pressure. That sensor feeds analog data
- 3:36Speaker 2: to a tiny micro controller okay, and then the micro
- 3:39Speaker 2: controller processes that data and mathematically decides, hey, that is
- 3:43Speaker 2: too much force. I need to turn on the red
- 3:45Speaker 2: led and slow down the motor.
- 3:48Speaker 1: That whole loop, that is an embedded system. It is
- 3:51Speaker 1: a layer of digital thinking tucked inside an everyday object.
- 3:54Speaker 2: Wow. And unlike my laptop, which, let's be honest, I
- 3:57Speaker 2: have to reboot like once a week because it just
- 3:58Speaker 2: gets confused. Yeah, things have to be incredibly robust.
- 4:02Speaker 1: That is the other massive key distinction here. These systems
- 4:05Speaker 1: don't usually have nice cooling fans. They have to survive
- 4:08Speaker 1: intense vibration, dust, wild temperature swings.
- 4:12Speaker 2: Because they're in the real world. Exactly. Think about it.
- 4:15Speaker 2: If your laptop crashes, you lose an unsaved word document annoying,
- 4:19Speaker 2: but fine. If the embedded system in your car is
- 4:22Speaker 2: anti lock breaking, unit crashes, oh man. The consequences are
- 4:25Speaker 2: physical and they are immediate.
- 4:27Speaker 1: That makes total sense. And this naturally bleeds into I
- 4:31Speaker 1: think the biggest buzzword of the last decade, which is
- 4:33Speaker 1: the Internet of things or IoT because once you have
- 4:36Speaker 1: that smart toothbrush, the next logical step for a company
- 4:40Speaker 1: is to make it talk to your phone. Right.
- 4:42Speaker 2: That is the natural evolution, and let draws a very
- 4:45Speaker 2: clear line there in the source material. Embedded systems evolve
- 4:48Speaker 2: into the Internet of things when they start communicating with
- 4:51Speaker 2: central nodes. It's all about massive network communication.
- 4:55Speaker 1: The book mentions some examples that really show the sheer
- 4:57Speaker 1: scale of this. On one hand, you have everyday stuff
- 5:00Speaker 1: like smart speakers, your Amazon Echo, Google Nest sitting in
- 5:04Speaker 1: your living room just waiting for a wake word.
- 5:06Speaker 2: Right, an admitted system that's listening, processing audio locally, and
- 5:10Speaker 2: then communicating with the cloud.
- 5:12Speaker 1: But then you connect that same concept to the industrial side.
- 5:16Speaker 1: Think about an oil pipeline. You have embedded systems monitoring
- 5:19Speaker 1: flow rates, pressure and temperature over thousands of miles of
- 5:25Speaker 1: pipe exactly.
- 5:26Speaker 2: So instead of a guy in a truck having to
- 5:28Speaker 2: drive out into the middle of nowhere to check a
- 5:29Speaker 2: physical gauge.
- 5:30Speaker 1: The pope itself basically sends a text message saying, Hey,
- 5:33Speaker 1: I'm leaking.
- 5:34Speaker 2: Yes. Yeah, it's incredibly efficient, but this is a big butt.
- 5:39Speaker 2: The book issues a pretty stark warning here regarding security.
- 5:43Speaker 2: Oh absolutely, because when you take a device that was
- 5:45Speaker 2: originally designed to be a simple, isolated specialist, like a
- 5:49Speaker 2: home thermostat or a pipeline valve, and you suddenly give
- 5:52Speaker 2: it a live Internet connection, you are opening a door.
- 5:55Speaker 1: And historically these things aren't exactly built with Fort Knox
- 5:58Speaker 1: level security, are they No.
- 6:00Speaker 2: Historically they are not. And that's exactly the danger. If
- 6:03Speaker 2: a malicious actor hacks your personal laptop, they might steal
- 6:07Speaker 2: your credit card info. That is bad, obviously, but it's manageable.
- 6:11Speaker 2: But if they hack an IoT system like a medical
- 6:15Speaker 2: pacemaker or that oil pipeline we mentioned, or the steering
- 6:18Speaker 2: control of a connected car, we aren't talking about data
- 6:21Speaker 2: loss anymore. We are talking about severe risks to physical safety.
- 6:25Speaker 1: It's the difference between a privacy nightmare and a literal
- 6:29Speaker 1: safety crisis.
- 6:29Speaker 2: Yeah, exactly. Leaden emphasizes that in this new IoT world.
- 6:34Speaker 2: Security cannot just be a software pass you add on later.
- 6:38Speaker 2: It has be baked into the very architecture of the
- 6:40Speaker 2: hardware from day one.
- 6:42Speaker 1: It's terrifying but also fascinating. Okay, let's step back a
- 6:45Speaker 1: bit and look at how these systems actually interact with
- 6:47Speaker 1: the physical world. Because a computer chip, at the end
- 6:50Speaker 1: of the day only knows ones and zeros. It doesn't
- 6:52Speaker 1: know what hot or fast or loud actually feels like.
- 6:55Speaker 1: It lives in this dark digital bubble.
- 6:58Speaker 2: And this is the realm of sensors. This is how
- 7:00Speaker 2: the system literally senses the outside world. Letting categorizes them
- 7:05Speaker 2: into two main buckets in the book that are super
- 7:07Speaker 2: helpful to understand, passive and active sensors.
- 7:10Speaker 1: Okay, passive sounds a bit safer. What is a passive sensor?
- 7:13Speaker 2: A passive sensor just sits there and measures the environment
- 7:16Speaker 2: exactly as it is. It's observant. A classic example he
- 7:19Speaker 2: gives as a thermister. A thermister, Yeah, it's a special
- 7:22Speaker 2: type of resistor that changes its electrical resistance based on
- 7:25Speaker 2: the ambient temperature. It's not doing anything to the air
- 7:27Speaker 2: around it. It's just reacting to the heat.
- 7:30Speaker 1: Okay, so kind of like a sponge soaking up water.
- 7:33Speaker 1: It changes its state based on the environment, but it
- 7:36Speaker 1: doesn't spray water back out.
- 7:38Speaker 2: That's a great analogy. Now contrast that with an active sensor.
- 7:41Speaker 2: An active sensor actually goes out and pokes the world
- 7:44Speaker 2: to see what happens.
- 7:45Speaker 1: It pokes the world.
- 7:47Speaker 2: Well in a way. Yes, think about an ultrasonic sensor.
- 7:50Speaker 2: These are used a lot in robotics and in the
- 7:51Speaker 2: parking sensors on your car bumber.
- 7:53Speaker 1: Oh, the ones that beep when you get too close
- 7:55Speaker 1: to a wall.
- 7:56Speaker 2: Exactly, that sensor actively sends out a ping, a high
- 8:00Speaker 2: frequency sound wave. Yeah, and then it immediately switches into
- 8:03Speaker 2: listening mode and waits to hear the echo bouncing back like.
- 8:06Speaker 1: A bat using echolocation or submarine.
- 8:09Speaker 2: Exactly like that. It uses a concept called time of flight.
- 8:13Speaker 2: The system knows the exact speed of sound, so it
- 8:15Speaker 2: sends the ping out, starts a tiny internal stopwatch. Here's
- 8:19Speaker 2: the echo return, and stops the watch.
- 8:21Speaker 1: Oh, and then it just does the math.
- 8:22Speaker 2: Right, the time it took tells you exactly how far
- 8:25Speaker 2: away the physical wall is. That is active sensing. You
- 8:28Speaker 2: generate a stimulus and you measure the real world response, and.
- 8:31Speaker 1: The source material mentions lightar and radar working on similar principles.
- 8:35Speaker 2: Right, Yes, lightar is completely fascinating. Instead of sound waves,
- 8:39Speaker 2: it uses pulses of laser light. By spinning that laser
- 8:43Speaker 2: around and measuring millions of those time of flight returns
- 8:46Speaker 2: every single second, an autonomous vehicle can build what's called
- 8:49Speaker 2: a point clide a point cloud. Yeah, it's basically a
- 8:52Speaker 2: real time three D map of the entire world around
- 8:55Speaker 2: the car. The computer knows that this specific cluster of
- 8:58Speaker 2: data points is a pedestrian walking, that cluster over there
- 9:01Speaker 2: is a stationary tree, and that fast moving cluster is
- 9:04Speaker 2: another car. It's literally seeing the world in three D geometry.
- 9:09Speaker 1: That is just incredible. But here is where it gets
- 9:11Speaker 1: really technical and honestly, I think really interesting. The real
- 9:15Speaker 1: world is analog like. Temperature doesn't just jump from seventy
- 9:20Speaker 1: degrees to seventy one degrees in a single instant step.
- 9:23Speaker 1: It flows smoothly, it's continuous, right, But computers are digital.
- 9:28Speaker 1: They only understand distinct steps. They're choppy. So how do
- 9:32Speaker 1: we bridge that gap between a smooth world and a
- 9:35Speaker 1: choppy computer.
- 9:36Speaker 2: That crucial job falls to the ADC. The analog to
- 9:39Speaker 2: digital converter. It acts as the ultimate translator. Imagine you
- 9:43Speaker 2: are drawing a smooth, sweeping curve on a piece of
- 9:46Speaker 2: graph paper.
- 9:47Speaker 1: Okay, I'm picturing it.
- 9:48Speaker 2: The real physical world is that smooth curve. The ADC
- 9:52Speaker 2: is looking at that curve at very specific tiny points
- 9:55Speaker 2: in time. This is called sampling it, and it's turning
- 9:57Speaker 2: each specific point into a precise digital number.
- 10:00Speaker 1: So if you don't sample it fast enough, you miss
- 10:02Speaker 1: all the details of the current exactly.
- 10:04Speaker 2: That's a problem called aliasing. If you blink too slowly,
- 10:06Speaker 2: you might miss the baseball flying right past your face.
- 10:09Speaker 2: The source material talks about the XCDC hardware on the
- 10:12Speaker 2: RDA seven board.
- 10:13Speaker 1: Right, the RDA seven, which is a specific FPGA development
- 10:17Speaker 1: board they use as an example.
- 10:18Speaker 2: Yes, that specific hardware can sample the analog world up
- 10:22Speaker 2: to one million times per second.
- 10:24Speaker 1: One million times a second. That is, I mean, I
- 10:28Speaker 1: can't even wrap my head around that.
- 10:29Speaker 2: And honestly, that's just considered standard for high performance control.
- 10:33Speaker 2: Some advanced radio frequency systems sampled into the billions of
- 10:36Speaker 2: times per second. It creates this absolutely massive fire hose
- 10:39Speaker 2: of numbers that the processor then has to crunch.
- 10:41Speaker 1: Okay, so we have the data. Now, the sensor has
- 10:43Speaker 1: picked up the physical world, the ADC has translated it
- 10:46Speaker 1: into digital numbers. Now, how does that data actually get
- 10:50Speaker 1: to the main brain of the system. We need a
- 10:52Speaker 1: nervous system.
- 10:53Speaker 2: We absolutely do. And these are called the communication protocols.
- 10:56Speaker 2: Depending on exactly what you're trying to do, you pick
- 10:59Speaker 2: a different digital language.
- 11:00Speaker 1: Let's run through the big ones mentioned in Letin's book.
- 11:03Speaker 1: Start with the absolute simplest one GPIO.
- 11:06Speaker 2: Okay, GPIO General purpose input output. This is basically the
- 11:11Speaker 2: brute force method. It's usually just a single wire that
- 11:14Speaker 2: is either on or off high voltage or low voltage.
- 11:17Speaker 1: One or zero, kind of like a physical light switch.
- 11:20Speaker 2: Perfect analogy is the machine's safety cover open, yes or no?
- 11:24Speaker 2: Is the emergency button currently pressed? Yes or no? It's
- 11:28Speaker 2: incredibly fast, it's instant, but it obviously doesn't carry complex data.
- 11:32Speaker 2: You can't send a JPEG image over a light switch.
- 11:35Speaker 1: Right, Okay, So what if we do need to send
- 11:37Speaker 1: actual complex data. The book talks about a protocol called
- 11:40Speaker 1: I two C.
- 11:41Speaker 2: I two C or inter integrated Circuit. I always like
- 11:45Speaker 2: to call this one the polite conversation.
- 11:46Speaker 1: Polite Why polite?
- 11:47Speaker 2: Because it uses just two wires. One wire is a
- 11:51Speaker 2: clock to keep the timing synchronized and the other is
- 11:53Speaker 2: for the actual data. But it can connect multiple different
- 11:56Speaker 2: devices using a clever address system. It uses a master
- 12:00Speaker 2: servant architecture. Okay, so the master controller says, hey, Sensor A,
- 12:04Speaker 2: it's your turn to speak, and Sensor A talks. Then
- 12:07Speaker 2: the master says, okay, thank you, Sensor B, now it's
- 12:09Speaker 2: your turn.
- 12:10Speaker 1: Ah, So they actually take turns on the wire.
- 12:12Speaker 2: Yes, it's what we call half duplex. You can only
- 12:15Speaker 2: send data or receive data at one specific time, not both.
- 12:18Speaker 2: It's great for simple things like reading a temperature sensor
- 12:21Speaker 2: once a second, but it's a bit slow.
- 12:23Speaker 1: So what if I have a real need for speed,
- 12:26Speaker 1: like if I'm streaming that crazy one million sample per
- 12:29Speaker 1: second data from the ADC, then you.
- 12:31Speaker 2: Need to upgrade to SPI Serial Peripheral Interface. This is
- 12:36Speaker 2: the speedy connection. It uses four wires instead of two,
- 12:39Speaker 2: and because it has completely separate dedicated wires for sending
- 12:43Speaker 2: and for receiving, it is full.
- 12:45Speaker 1: Duplex, meaning it can talk and listen at the exact
- 12:48Speaker 1: same time exactly. Sounds like a chaotic argument where everyone
- 12:51Speaker 1: is just yelling over each other.
- 12:53Speaker 2: Actually, it's more like a highly efficient high speed telephone
- 12:56Speaker 2: call where both people are talking and perfectly understanding each
- 12:59Speaker 2: other simultananeously. It can run much much faster than it
- 13:02Speaker 2: two see easily up to fifty mega herds for more wow.
- 13:05Speaker 1: Okay, but what about inside cars? Because I know modern
- 13:09Speaker 1: cars are an absolute nightmare of electrical noise. You have
- 13:12Speaker 1: spark plugs firing thousands of times a minute, giant alternator
- 13:15Speaker 1: spinning that creates massive electromagnetic interference.
- 13:19Speaker 2: Very hostile environment for electronics.
- 13:21Speaker 1: So how do the tiny computer chips communicate without their
- 13:24Speaker 1: data just getting completely scrambled by all that engine noise?
- 13:27Speaker 2: That is exactly where the CANbus comes in the controller
- 13:30Speaker 2: area network. It is the absolute gold standard for automotive systems,
- 13:36Speaker 2: and the way it physically handles that noise is just
- 13:39Speaker 2: brilliant physics.
- 13:40Speaker 1: Okay, how does it work.
- 13:41Speaker 2: It uses something called differential signaling. Imagine you have two
- 13:45Speaker 2: separate wires running right next to each other through the car.
- 13:49Speaker 2: When the system wants to send a signal, it sends
- 13:51Speaker 2: a positive voltage down one wire and a negative voltage
- 13:55Speaker 2: down the other wire.
- 13:56Speaker 1: Okay, so like a plus one on the first wire
- 13:58Speaker 1: and a minus one on the second wire.
- 14:00Speaker 2: Right now, the receiving chip at the other end doesn't
- 14:02Speaker 2: look at the absolute voltage on either wire. It strictly
- 14:05Speaker 2: looks at the difference between the two wires. So positive
- 14:08Speaker 2: one minus negative one equals two. The intended signal is two.
- 14:11Speaker 1: Okay, I follow the math.
- 14:13Speaker 2: Now, imagine a huge spike of electrical noise from the
- 14:16Speaker 2: engine suddenly hits those wires. Because the wires are physically
- 14:20Speaker 2: twisted together, the noise hits both wires equally. Right, Let's
- 14:24Speaker 2: say it adds ten volts of pure noise, So the
- 14:26Speaker 2: plus one wire becomes plus eleven and the minus one
- 14:28Speaker 2: wire becomes plus nine.
- 14:30Speaker 1: Ah, so both numbers instantly jump up.
- 14:32Speaker 2: They do, but the receiver only cares about the mathematical
- 14:35Speaker 2: difference between them, and eleven minus nine is still two.
- 14:39Speaker 1: The signal is perfectly preserved exactly.
- 14:42Speaker 2: The noise literally cancels itself out. It is an incredibly
- 14:46Speaker 2: robust design. That is exactly why your anti lock breaks
- 14:49Speaker 2: still work perfectly even when your engine is screaming at
- 14:52Speaker 2: the red line.
- 14:52Speaker 1: That is so smart. It's just elegant engineering.
- 14:55Speaker 2: It really is. And there's one more very cool thing
- 14:57Speaker 2: about cambus. Unlike it two C, there is no master controller.
- 15:01Speaker 2: It's entirely peer to peer.
- 15:03Speaker 1: Wait, so who decides who gets to talk? If there's
- 15:06Speaker 1: no master it sounds like it would be chaos.
- 15:08Speaker 2: The priority is actually built directly into the message ID
- 15:11Speaker 2: number itself. If it deploy breaks message and the turn
- 15:15Speaker 2: up radio volume message both try to talk on the
- 15:17Speaker 2: network at the exact same millisecond. The system is physically
- 15:20Speaker 2: designed so that the breaks have a lower ID number,
- 15:23Speaker 2: and on a canvas, a lower number mathematically wins out
- 15:26Speaker 2: and gets higher priority.
- 15:27Speaker 1: That is amazing. The radio automatically just shuts up and
- 15:30Speaker 1: waits yep.
- 15:31Speaker 2: The physics of the wire forced the lower priority message
- 15:34Speaker 2: to back off.
- 15:34Speaker 1: I honestly wish human conversations worked like that, Like important
- 15:38Speaker 1: safety info just mathematically overrides small talk.
- 15:42Speaker 2: It would definitely make office meetings a lot more efficient.
- 15:45Speaker 1: No kidding, Okay, So we had our sensors and we
- 15:48Speaker 1: have the nervous system protocols. Now, let's talk about the brain.
- 15:51Speaker 1: And this is where the book really focuses heavily. We
- 15:55Speaker 1: aren't just talking about normal CPUs here, we are talking
- 15:58Speaker 1: about FPG.
- 16:00Speaker 2: Yes, this is where the engineering gets really interesting. FPGA
- 16:04Speaker 2: stands for field programmable gate array.
- 16:07Speaker 1: Field programmable makes it sound like I can literally fix
- 16:10Speaker 1: it while I'm standing out in a cornfield.
- 16:12Speaker 2: I mean, basically, yes, it means you can completely change
- 16:14Speaker 2: how the physical chip works after it has already been
- 16:17Speaker 2: manufactured and deployed in the field.
- 16:19Speaker 1: How is that fundamentally different from a normal computer processor
- 16:22Speaker 1: like the one in my laptop.
- 16:23Speaker 2: Well, a normal CPU like an Intel or AMD chip
- 16:27Speaker 2: has a totally fixed hardware structure. It is etched in silicon.
- 16:31Speaker 2: It reads software instructions one by one from memory. Add
- 16:35Speaker 2: this number, then move this data, then check this condition.
- 16:38Speaker 2: It operates sequentially right, one step at a time, exactly.
- 16:41Speaker 2: And FPGA, on the other hand, is basically a blank
- 16:45Speaker 2: box of digital lego bricks. Raw logic gates, memory blocks
- 16:49Speaker 2: flip flops. When you program it. You don't write software
- 16:52Speaker 2: that runs on the chip. You write code that literally
- 16:55Speaker 2: rewires the electrical connections between those internal lego bricks.
- 16:59Speaker 1: Wait, I'm physically well electronically changing the actual circuit.
- 17:03Speaker 2: Yes, you are literally creating custom hardware on the fly.
- 17:07Speaker 1: Let's break down those lego bricks you mentioned. The book
- 17:09Speaker 1: talks a lot about logic gates.
- 17:10Speaker 2: Right, These are the fundamental decision makers of the digital world.
- 17:13Speaker 2: You have eighty gates which say if input A andy
- 17:16Speaker 2: input B are true, then do this. You haver gates,
- 17:20Speaker 2: exoor gates, and then you have flip flops, which act
- 17:23Speaker 2: as high speed memory units. They hold a single bit
- 17:26Speaker 2: of data for a split second based on the ticking
- 17:28Speaker 2: of the system clock.
- 17:29Speaker 1: And a single FPGA is just made of millions of
- 17:31Speaker 1: these little gates, millions.
- 17:33Speaker 2: Of them, and because you are wiring them all up
- 17:35Speaker 2: yourself in whatever pattern you need, you unlock the FPGA's
- 17:38Speaker 2: true superpower parallelism. Parallelism that is definitely the key word here.
- 17:43Speaker 2: Think of a standard CPU as a genius level math professor.
- 17:47Speaker 2: He can solve absolutely any problem you give him, but
- 17:49Speaker 2: he can only solve one problem at a time. He
- 17:52Speaker 2: is very fast, but he's working entirely alone. Okay, And
- 17:57Speaker 2: FPGA is more like a giant room flow of ten
- 18:00Speaker 2: thousand middle school students. They might not be as smart
- 18:03Speaker 2: individually as the professor, but they can all solve a specific,
- 18:07Speaker 2: simple problem at the exact same time.
- 18:09Speaker 1: So if I'm processing an image that has a million pixels,
- 18:12Speaker 1: the normal CPU has to look at pixel one, then
- 18:15Speaker 1: pixel two, then pixel three exactly.
- 18:17Speaker 2: Even if it does it fast, it's still sequential. The FPGA, however,
- 18:20Speaker 2: can be wired to look at all one million pixels,
- 18:22Speaker 2: simultaneously process every single one of them, and be completely
- 18:26Speaker 2: done in a single tick of the clock. That is
- 18:28Speaker 2: true hardware acceleration. It's not just about running faster, it's
- 18:31Speaker 2: about doing everything at once.
- 18:32Speaker 1: That honestly blows my mind. But you don't use regular
- 18:35Speaker 1: programming languages like Python or C plus plus to program
- 18:39Speaker 1: these things, do you.
- 18:40Speaker 2: Well? You can use C plus plus with some newer
- 18:43Speaker 2: high level synthesis tools now, which definitely helps. But underneath
- 18:46Speaker 2: it all the native tongue of the FPGA is VHDL
- 18:50Speaker 2: or verolog. These are hardware description languages.
- 18:53Speaker 1: Hardware description.
- 18:55Speaker 2: Right when you type in violog, you aren't writing a
- 18:58Speaker 2: sequential to do list for the computer. You are describing
- 19:01Speaker 2: a physical structure. You are telling the software I need
- 19:04Speaker 2: you to connect this wire to that specific gait.
- 19:07Speaker 1: It's drawing architectural pootprints, not writing a recipe.
- 19:09Speaker 2: Perfectly put, it is hardware design, just done at a keyboard.
- 19:13Speaker 1: So we have this amazing custom hardware brain. But there
- 19:16Speaker 1: is one more massive constraint that Leaden really hammers home
- 19:19Speaker 1: in the book, and that is the concept of real time.
- 19:23Speaker 2: Yes, and this is a concept that is so often misunderstood.
- 19:26Speaker 2: Real time does not just mean really fast. A supercomputer
- 19:30Speaker 2: taking three days to predict the global weather is incredibly fast,
- 19:33Speaker 2: but it's not real time. Real time means computing with
- 19:36Speaker 2: the strict deadline.
- 19:37Speaker 1: A deadline like it has to be done by a
- 19:39Speaker 1: certain millisecond.
- 19:41Speaker 2: The mantra of embedded engineering is the system must be
- 19:45Speaker 2: functionally correct, meaning it gets the right math answer, and
- 19:48Speaker 2: it must be temporarily correct, meaning it gets that answer
- 19:51Speaker 2: at the exact right time. If the right answer arrives late,
- 19:55Speaker 2: it is a wrong answer.
- 19:56Speaker 1: The book distinguishes between hard and soft real time systems.
- 20:01Speaker 1: What are the stakes here?
- 20:03Speaker 2: Soft real time is low stakes. The classic example used
- 20:07Speaker 2: is a car keyfob. You walk up to your car,
- 20:09Speaker 2: you press the unlocked button. If the system takes two
- 20:12Speaker 2: seconds to unlock the door instead of point one seconds,
- 20:15Speaker 2: you might be annoyed.
- 20:16Speaker 1: Right, you might angrily press the button this second time.
- 20:19Speaker 2: Exactly, but the system hasn't catastrophically failed. No one is hurt.
- 20:23Speaker 2: It just lag right. But hard real time think about
- 20:28Speaker 2: the airbag controller in that same car. If you can
- 20:30Speaker 2: do a crash, the sensor detects the sudden impact, the
- 20:32Speaker 2: processor has to calculate the force and physically fire the
- 20:35Speaker 2: air bag. If that system deploys the air bag even
- 20:38Speaker 2: one hundred milliseconds.
- 20:39Speaker 1: Too late, it's entirely useless. Or even worse, it deploys
- 20:42Speaker 1: right as your head is moving forward and actually hurts
- 20:44Speaker 1: you exactly.
- 20:45Speaker 2: That is a total system failure. In hard real time engineering,
- 20:49Speaker 2: missing the deadline by a fraction of a second is
- 20:52Speaker 2: literally the exact same thing as the computer completely crashing.
- 20:56Speaker 1: This has to create a huge challenge for the programmer,
- 20:58Speaker 1: doesn't it. Because the process is usually doing a dozen
- 21:01Speaker 1: things at once. It has to check the sensors, It
- 21:04Speaker 1: has to update the dashboard display, it has to talk
- 21:06Speaker 1: to the CAN network. How do you guarantee that the
- 21:10Speaker 1: life or death stuff happens first?
- 21:12Speaker 2: That is known as the scheduling challenge, and the book
- 21:15Speaker 2: discusses this in great detail. I imagine you have an
- 21:18Speaker 2: electric motor that needs its voltage adjusted fifty times every
- 21:22Speaker 2: single second, so fifty hertz, just to run smoothly without
- 21:25Speaker 2: burning out. But the processor also has a display screen
- 21:28Speaker 2: that it needs to update ten times a second.
- 21:30Speaker 1: And if the display update takes just a little bit
- 21:32Speaker 1: too long to draw the graphics.
- 21:34Speaker 2: The motor doesn't get its critical voltage adjustment on time.
- 21:36Speaker 2: The motor physically stutters. In the industry, that's called jitter. Yeah,
- 21:40Speaker 2: and jitter is the absolute enemy of real time systems.
- 21:43Speaker 1: Jitter just the word makes me anxious. So how do
- 21:46Speaker 1: engineers fix it?
- 21:47Speaker 2: The standard solution is using an RCOs, a real time
- 21:51Speaker 2: operating system. It's a highly specialized operating system that acts
- 21:54Speaker 2: like a completely ruthless traffic cop. Yeah. It manages all
- 21:58Speaker 2: the system priorities using some they called preemptive multitasking.
- 22:02Speaker 1: Preemptive meaning just violently interrupts whatever is happening ruthlessly.
- 22:06Speaker 2: If the motor control task suddenly says, hey, it's my
- 22:09Speaker 2: exact millisecond I need to run right now, the RTOS
- 22:13Speaker 2: instantly pauses the display update task right in the middle
- 22:17Speaker 2: of drawing a pixel. Let's the motor code run, and
- 22:20Speaker 2: then it resumes the display. It doesn't ask permission. It
- 22:23Speaker 2: absolutely ensures the heart deadlines are met, even if the
- 22:26Speaker 2: soft deadlines have to wait a microsecond. M Wow.
- 22:29Speaker 1: Okay, So bringing this all together, we have gone on
- 22:32Speaker 1: quite a journey here. We start from a physical change
- 22:35Speaker 1: out in the real world, a temperature rise or a
- 22:37Speaker 1: brake pedal being pressed. Right, that physical change becomes an
- 22:41Speaker 1: electrical signal through a sensor. The ADC translates that analog
- 22:44Speaker 1: wave into digital numbers. Then those protocols, the ITCDESPI, the
- 22:48Speaker 1: can bus zip that data safely through the nervous system.
- 22:51Speaker 1: It finally lands in a processor, maybe an FPGA, which
- 22:55Speaker 1: might literally be physically rewired just to handle that specific
- 22:58Speaker 1: data perfectly. All all of this is happening under a microscopic,
- 23:02Speaker 1: strict deadline managed by a ruthless RTOS.
- 23:06Speaker 2: Honestly, when you summarize it all put together like that
- 23:09Speaker 2: is kind of a miracle that anything in our modern
- 23:11Speaker 2: world works at all.
- 23:12Speaker 1: It really is. It completely changes how you look at
- 23:14Speaker 1: everyday things. When I go out and unlock my car
- 23:17Speaker 1: door today, I'm not just opening a door. I am
- 23:20Speaker 1: triggering a massive, silent symphony of physics, electrical engineering, digital logic,
- 23:25Speaker 1: and perfect timing.
- 23:27Speaker 2: And that is the true AHA moment for me. When
- 23:29Speaker 2: studying this stuff. We look at a car or a
- 23:32Speaker 2: smartphone and we just see a single solid object. But
- 23:34Speaker 2: underneath the metal and glass. It's actually a high speed
- 23:37Speaker 2: conversation between hundreds of tiny specialized computer systems, all shouting
- 23:42Speaker 2: at each other in perfect synchronization.
- 23:44Speaker 1: Before we wrap up today, I really want to leave
- 23:46Speaker 1: you the listener with a provocative thought that struck me
- 23:50Speaker 1: while reading the source material about FPGAs. We are so
- 23:53Speaker 1: used to the idea that hardware is hard it's the physical,
- 23:57Speaker 1: unchangeable silicon chip, and that software is soft it's the
- 24:01Speaker 1: code you can easily update.
- 24:03Speaker 2: Right, That's the classic divide.
- 24:04Speaker 1: But with FPGAs we are literally rewriting the physical circuit
- 24:09Speaker 1: layout on the fly, we are downloading hardware.
- 24:12Speaker 2: It raises a really fascinating question.
- 24:14Speaker 1: About the future, right, like, where does the line between
- 24:17Speaker 1: hardware and software actually exist anymore? If I can just
- 24:20Speaker 1: download a file from the Internet that fundamentally changes the
- 24:22Speaker 1: physical electrical pathways of my computer chip, essentially downloading an
- 24:26Speaker 1: entirely new computer architecture over Wi Fi, are we entering
- 24:29Speaker 1: an arrow where the hardware itself is just as fluid
- 24:32Speaker 1: and temporary as the code running on top of it.
- 24:34Speaker 2: That is the absolute frontier of embedded design, And as
- 24:37Speaker 2: these systems get more connected and more complex, that dividing
- 24:40Speaker 2: line is only going to get blurrier and blurrier. The
- 24:43Speaker 2: rigid static hardware of the past is very quickly becoming
- 24:46Speaker 2: a memory.
- 24:47Speaker 1: Definitely something to mull over the next time you are
- 24:49Speaker 1: standing in the bathroom waiting for your smart toothbrush to
- 24:52Speaker 1: perform a firmware update exactly Well, that is it for
- 24:56Speaker 1: this deep dive into the invisible infrastructure of our life vibes.
- 25:00Speaker 1: Thanks so much for listening.