HDLBits is a collection of digital circuit design exercises and an online judge for learning digital logic using the Verilog hardware description language. Most of the problems on HDLBits are designed to be short problems with short solutions. We compile and test your code and compare it to our reference solution to give immediate feedback on correctness, often with debugging information.
Like any other language (programming, hardware design, or a human language), fluency in a hardware description language can be acquired much more efficiently by practice than if done solely through lectures and studying textbooks. But getting practice is hard when there is a steep initial learning curve and a lack of feedback. One day, I realized that I could address both of these problems by building an online tool, and that this tool could be simple enough to be hacked together in a weekend. So here we are.
HDLBits was created by Henry Wong, a Ph.D. student at the University of Toronto who spent 7 years as a teaching assistant in digital logic and computer organization (ECE243, ECE253, and ECE241).
As digital logic is a topic within electrical and computer engineering, there is a strong focus on building things, and not just studying them. From the labs and exams I’ve seen over my years as a teaching assistant, students often seem to suffer from a lack of practice in doing circuit design, which includes both design and debug. Every year there are stories of students in a lab saying “my circuit doesn’t work, here are my simulations”, being oblivious that their simulations also show their circuit is incorrect.
My belief is that practice and getting comfortable with the basics will build the fluency needed to learn bigger circuits. You can afford to get compile errors and look up your notes every line for a 10-line circuit, but not for a 50-line answer on an exam (where errors come in the form of lost marks) or 1000-line project.
What obstacles are there to practicing?
- The steep initial learning curve: The learning curve is not only in learning digital logic but also a new language, and installing and using large software packages.
- A lack of exercises with feedback: Coming up with good exercises is challenging even for me, and much harder still when just starting out. Even once you do build something, verifying your design’s correctness (i.e., debugging) is also a difficult skill to learn.
HDLBits aims to address these by providing a problem set with an online judge, making it easy to test simple circuits just by clicking “Submit and Compile”. It doesn’t remove the need to learn the real tools, but hopefully makes the path towards it less like running straight into a brick wall and more like swimming up a fish ladder.