Looking For Pi In The 8087 Math Coprocessor Chip

Even with ten fingers to work with, math can be hard. Microprocessors, with the silicon equivalent of just two fingers, can have an even harder time with calculations, often taking multiple machine cycles to figure out something as simple as pi. And so 40 years ago, Intel decided to give its fledgling microprocessors a break by introducing the 8087 floating-point coprocessor.

If you’ve ever wondered what was going on inside the 8087, wonder no more. [Ken Shirriff] has decapped an 8087 to reveal its inner structure, which turns out to be closely related to its function. After a quick tour of the general layout of the die, including locating the microcode engine and ROM, and a quick review of the NMOS architecture of the four-decade-old technology, [Ken] dug into the meat of the coprocessor and the reason it could speed up certain floating-point calculations by up to 100-fold. A generous portion of the complex die is devoted to a ROM that does nothing but store constants needed for its calculation algorithms. By carefully examining the pattern of NMOS transistors in the ROM area and making some educated guesses, he was able to see the binary representation of constants such as pi and the square root of two. There’s also an extensive series of arctangent and log2 constants, used for the CORDIC algorithm, which reduces otherwise complex transcendental calculations to a few quick and easy bitwise shifts and adds.

[Ken] has popped the hood on a lot of chips before, finding butterflies in an op-amp and reverse-engineering a Sinclair scientific calculator. But there’s something about seeing constants hard-coded in silicon that really fascinates us.

Bricking Your 3D Printer, In A Good Way

In our vernacular, bricking something is almost never good. It implies that something has gone very wrong indeed, and that your once-useful and likely expensive widget is now about as useful as a brick. Given their importance to civilization, that seems somewhat unfair to bricks, but it gets the point across.

It turns out, though, that bricks can play an important role in 3D-printing in terms of both noise control and print quality. As [Stefan] points out in the video below, living with a 3D printer whirring away on a long print can be disturbing, especially when the vibrations of the stepper motors are transmitted into and amplified by a solid surface, like a benchtop. He found that isolating the printer from the resonant surface was the key. While the stock felt pad feet on his Original Prusa i3 Mk 3S helped, the best results were achieved by building a platform of closed-cell packing foam and a concrete paver block. The combination of the springy foam and the dampening mass of the paver brought the sound level down almost 8 dBA.

[Stefan] also thoughtfully tested his setups on print quality. Machine tools generally perform better with more mass to damp unwanted vibration, so it stands to reason that perching a printer on top of a heavy concrete slab would improve performance. Even though the difference in quality wasn’t huge, it was noticeable, and coupled with the noise reduction, it makes the inclusion of a paver and some scraps of foam into your printing setup a no-brainer.

Not content to spend just a couple of bucks on a paver for vibration damping? Then cast a composite epoxy base for your machine — either with aluminum or with granite.

Continue reading “Bricking Your 3D Printer, In A Good Way”

Using Valgrind To Analyze Code For Bottlenecks Makes Faster, Less Power-Hungry Programs

What is the right time to optimize code? This is a very good question, which usually comes down to two answers. The first answer is to have a good design for the code to begin with, because ‘optimization’ does not mean ‘fixing bad design decisions’. The second answer is that it should happen after the application has been sufficiently debugged and its developers are at risk of getting bored.

There should also be a goal for the optimization, based on what makes sense for the application. Does it need to process data faster? Should it send less data over the network or to disk? Shouldn’t one really have a look at that memory usage? And just what is going on inside those CPU caches that makes performance sometimes drop off a cliff on a single core?

All of this and more can be analyzed using tools from the Valgrind suite, including Cachegrind, Callgrind, DHAT and Massif.

Keeping Those Cores Cool

Modern day processors are designed with low power usage in mind, regardless of whether they are aimed at servers, desktop systems or embedded applications. This essentially means that they are in a low power state when not doing any work (idle loop), with some CPUs and microcontrollers turning off power to parts of the chip which are not being used. Consequently, the more the processor has to do, the more power it will use and the hotter it will get.

Continue reading “Using Valgrind To Analyze Code For Bottlenecks Makes Faster, Less Power-Hungry Programs”

Don’t Trust Your Ears For The Freshest Chips

We hear fables of how to restore the crispness to your crisp and the crackle to your crackers, but they are more hot air than some of the methods. We found one solution that has some teeth though, and it doesn’t require any kitchen appliances, just a pair of headphones. Keep reading before you mash potato chips into your Beats. [Charles Spence] co-authors a paper with [Massimiliano Zampini] titled The Role of Auditory Cues in Modulating the Perceived Crispness and Staleness of Potato Chips. It’s a mouthful, so folks refer to it as the “Sonic Chip Experiment,” which rolls off the tongue. The paper is behind paywalls, but you can find it if you know where to look.

The experiment puts participants in some headphones while they eat Pringles, and researchers feed them different sound waves. Sometimes the sound file is a recording of crackly chewing, and other times it is muffled mastication. The constant was the Pringles, which are a delight for testing because they are uniform. Participants report that some chips are fresher than others. This means we use our ears to help judge consumable consistency. Even people who knew all about the experiment report they can willingly fool themselves with the recordings.

What other foods would benefit from the augmented crunch, and which ones would suffer? If shapely food is your jam, we have a holy cookie which is probably best enjoyed with your eyes. If you prefer your Skittles organized by color, we have you covered.

Continue reading “Don’t Trust Your Ears For The Freshest Chips”

Masten Moon Rocket Has Landing Pad, Will Travel

Because of the architecture used for the Apollo missions, extended stays on the surface of the Moon weren’t possible. The spartan Lunar Module simply wasn’t large enough to support excursions of more than a few days in length, and even that would be pushing the edge of the envelope. But then the Apollo program was never intended to be anything more than a proof of concept, to demonstrate that humans could make a controlled landing on the Moon and return to Earth safely. It was always assumed that more detailed explorations would happen on later missions with more advanced equipment and spacecraft.

Now NASA hopes that’s finally going to happen in the 2020s as part of its Artemis program. These missions won’t just be sightseeing trips, the agency says they’re returning with the goal of building a sustainable infrastructure on and around our nearest celestial neighbor. With a space station in lunar orbit and a permanent outpost on the surface, personnel could be regularly shuttled between the Earth and Moon similar to how crew rotations are currently handled on the International Space Station.

Artemis lander concept

Naturally, there are quite a few technical challenges that need to be addressed before that can happen. A major one is finding ways to safely and accurately deliver multiple payloads to the lunar surface. Building a Moon outpost will be a lot harder if all of its principle modules land several kilometers away from each other, so NASA is partnering with commercial companies to develop crew and cargo vehicles that are capable of high precision landings.

But bringing them down accurately is only half the problem. The Apollo Lunar Module is by far the largest and heaviest object that humanity has ever landed on another celestial body, but it’s absolutely dwarfed by some of the vehicles and components that NASA is considering for the Artemis program. There’s a very real concern that the powerful rocket engines required to gracefully lower these massive craft to the lunar surface might kick up a dangerous cloud of high-velocity dust and debris. In extreme cases, the lander could even find itself touching down at the bottom of a freshly dug crater.

Of course, the logical solution is to build hardened landing pads around the Artemis Base Camp that can support these heavyweight vehicles. But that leads to something of a “Chicken and Egg” problem: how do you build a suitable landing pad if you can’t transport large amounts of material to the surface in the first place? There are a few different approaches being considered to solve this problem, but certainly one of the most interesting among them is the idea proposed by Masten Space Systems. Their experimental technique would allow a rocket engine to literally build its own landing pad by spraying molten aluminum as it approaches the lunar surface.

Continue reading “Masten Moon Rocket Has Landing Pad, Will Travel”

ZRAM Boosts Raspberry Pi Performance

Linux is a two-edged sword. On the one hand, there’s so much you can configure. On the other hand, there’s so much you can configure. It is sometimes hard to know just what you should do to get the best performance, especially on a small platform like the Raspberry Pi. [Hayden James] has a suggestion: enable ZRAM and tweak the kernel to match.

Although the post focuses on the Raspberry Pi 4, it applies to any Linux system that has limited memory including older Pi boards. The idea is to use a portion of main memory as a swap file. At first, that might seem like a waste since you could use that memory to, you know, actually run programs. However, the swap devices are compressed, so you get more swap space and transfers from these compressed swap devices and main memory are lightning-fast compared to a hard drive or solid state disk drive.

Continue reading “ZRAM Boosts Raspberry Pi Performance”

Poking Around Inside Of A Linux Security Camera

This deep dive into the Linux-powered Reolink B800 IP camera started because of a broken promise from its manufacturer. When [George Hilliard] purchased a kit that included six of the cameras and a video recorder, the website said they were capable of outputting standard RTSP video. But once he took delivery of the goods, and naturally after his return window had closed, the site was updated to say that the cameras can only function with the included recorder.

Taking that as something of challenge, [George] got to work. His first big break came when he desoldered the camera’s SPI flash chip and replaced it with a socket. That allowed him to easily take the chip out of the device for reading and flashing as he tinkered with modifying the firmware. After adding cross-compiled versions of busybox, gdb, and strace to the extracted firmware, he bundled it back up and flashed it back to the hardware.

If you think that’s the end of the story, it isn’t. In fact, it’s just the beginning. While getting root-level access to the camera’s OS would have potentially allowed for [George] to dump all the proprietary software it was running and replace it with open alternatives, he decided to take a different approach.

Instead of replacing the camera’s original software, he used his newly granted root powers to analyze it and figure out how it worked. This allowed for to sniff out some very suspect “encryption” routines built into the software, and eventually write his own server side in Rust that finally allowed him to use the cameras with his own server…albeit with a bit more work than he bargained for.

Projects like these are a fantastic look at real world reverse engineering, and a reminder that sometimes achieving your ultimate goal means taking the long way around. Even if you’re not in the market for a hacked security camera, there’s no doubt that reading the thorough write-up [George] has prepared will teach you a few things. But of course, we’d expect no less from a guy who runs Linux on his business card.