FPGA Testbenches Made Easier

You finally finish writing the Verilog for that amazing new DSP function that will revolutionize human society and make you rich. Does it work? Your first instinct, of course, is to blow it into your FPGA of choice and see if it works. If it does, that was a great idea. If it doesn’t, it was a terrible idea because — typically — it is hard to look inside the FPGA. That’s why you’ll typical simulate your logic on a desktop computer before you commit it to the FPGA. But that means you have to delay gratification long enough to write a testbench — a piece of hardware description language (HDL) code that exercises the function you wrote. In this post I’ll show you a small piece of software that can read your Verilog module and automatically create most of a testbench for you. The code originally came from GitHub, but I wanted to make some changes to it, so I forked it and I’ll tell you about the changes I made. This isn’t specific to a particular FPGA. Any Verilog project can use the tool to generate a simple starter testbench.

Writing a testbench isn’t that hard. You usually use the same language you wrote the original code in but since it won’t reside in silicon, you can do things in the simulator that you can’t get away with in code that you’ll synthesize. However, it is a bit painful to have to always write more or less the same code, especially if you have a lot of modules you want to test. But it is a good idea to test small modules before linking them together and then test them linked together, too. With this little Python script, it is very easy to generate a simple testbench and then further elaborate it. It isn’t life-changing, but it does save some time. If you want to try this out, you’ll need something to run the Python script on, of course. You also need a Verilog simulator or you can use EDA Playground to try all this out in your browser.

Continue reading “FPGA Testbenches Made Easier” →

How’s A Gyro Work?

It wasn’t long ago that a gyro — or gyroscope — was an exotic piece of electronics gear. Most of us only saw them as children’s toys that would balance on your finger. That’s changed, though, thanks to microelectronics. Now your game controller, your phone, and your drone all probably use little ICs that are actually three-axis gyroscopes. Ever wonder how they work and what they do? [RCModelReviews] has a video that covers three kinds of gyros: old mechanical gyros, modern MEMS gyros, and even an exotic laser-based gyro. (YouTube, embedded below.)

Gyroscopes allow you to detect orientation by detecting linear forces on a rotating element. They are used in everything from spacecraft to submarines. The device has many origins dating back to antiquity. But the modern gyro showed up around 1800 or so. The children’s toy appeared in 1917 and is still made today.

Continue reading “How’s A Gyro Work?” →

Backyard Planetarium With Magnets

If you are a Hackaday reader, you probably like space in real life, fiction, or both. A trip to a planetarium is a great treat, but what if you could have a planetarium in your backyard? [Ecasill] thought so and used a Zip Tie domes kit to create just such a thing. It takes some sewing and a projector, but there’s a problem. The dome needs to come down if there is going to be bad weather. The answer? Magnetic dowel rods.

Because the magnets are brittle, plastic dip covers them after epoxy sticks them in place. The cloth has steel bolts to adhere, too. All in, the setup cost about $2,000. That includes a projector, a mirror ball, a sound system, and all the construction.

Continue reading “Backyard Planetarium With Magnets” →

What’s The Difference? Ask An Op Amp

If you’ve ever wondered why an op amp has the little plus and minus symbols on it, its because at the heart of it, the device is a differential amplifier. The problem is that — ideally, at least — it has infinite gain so it works like a comparator and that’s not what you usually want. So we put resistors around the thing to constrain it and get useful amplification out of it. [Stephen Mendes] does the analysis for you about how the standard configuration for a differential amplifier works. He assumes you know the stock formulae for the inverting and non-inverting amplifier configurations and uses superposition.

[Stephen] mentions that’s the easiest way to do it and then goes on to do it sort of how we would do it as a check. We think that’s the easier method, but maybe its a matter of preference. Either way, you get the right answer.

Continue reading “What’s The Difference? Ask An Op Amp” →

A $4 Ultrasonic Theremin Looks Cheesy On Purpose

We don’t think [bleepbit] will take offense when we say the “poor man’s theremin” looks cheesy — after all, it was built in a cheese container. Actually, it isn’t a bad case for a simple device, as you can see in the picture and the video below. Unlike a traditional theremin, the device uses ultrasonics to detect how far away your hand is and modifies the sound based on that.

There are also two buttons — one to turn the sound off and another to cycle through some effects. We liked how it looked like a retro cassette, though. The device uses a cheap Arduino clone, but even with a real Arduino, the price wouldn’t be too bad. However, the price tag quoted doesn’t include a few connectors or the speaker that appears in the schematic. There’s a note that the model built uses a jack instead of a speaker, but it would be nice to include both and use the kind of jack that disconnects the speaker when you plug speakers or headphones in.

Continue reading “A $4 Ultrasonic Theremin Looks Cheesy On Purpose” →

Back To School Online

In 1961, FCC Commissioner [Newt Minow] famously described TV as a “vast wasteland.” But TV can do great things; educational programming, news coverage, and great performances do appear, just not all that often. You can draw the same parallels to the Internet. Sure, it’s mostly cat pictures, snarky comments, and posts of what your friends had for dinner. But it can also be a powerful tool, especially for education. Recently, top-name schools and other institutions have posted courses online for everything from Python to Quantum Mechanics to Dutch. The problems are finding these classes and figuring out which ones are gems and which are duds. A site called Class-Central aims to solve these problems.

The site aggregates class descriptions from a variety of sources like edX, Coursea, and more. Users can rate the classes. Many of these courses are free to take. The recent trend is to offer the content for free, but charge for people who want an assessment, such as a certificate of completion or even a full-blown degree. Even then, the cost is typically far less than traditional college costs.

There’s also news about courses. For example, a recent post highlighted that edX now offers nine online master’s degrees in conjunction with major schools. A computer science masters from the University of Texas, for example, runs about $10,000. A Georgia Tech cybersecurity masters degree costs even less. There are another seven not ready yet, including one for electrical engineering.

Continue reading “Back To School Online” →

E-Mail Service Claims It Doesn’t Store Your Mail

There have been many news stories lately about companies misusing your data, including your e-mails. What’s more, these giant repositories of data are favorite targets for hackers. Even if you trust the big corporations, you are also betting on their security. Criptext claims they have (possibly) the most private e-mail service ever. It uses the openĀ Signal protocol and stores private keys and encrypted mail only on your device. All the applications to access your mail are open source, so presumably, someone would eventually spot any backdoors or open holes.

At the moment the service is free and the company reports that even when a paid offering is ready, there will still be a free tier. Of course, you can send and receive normal e-mail, too. You can also use a passphrase you send to someone else (presumably not by e-mail) so they can read an encrypted message.

Continue reading “E-Mail Service Claims It Doesn’t Store Your Mail” →