DEV Community

Nihal Rajpal
Nihal Rajpal

Posted on

GSoC 2025 – Week 2: Comparator and Pull Resistor Implementation

This week (June 9–15), I continued with component development for CircuitVerse by focusing on adding two new hardware-oriented elements: the Comparator and the Pull Resistor.

Comparator Component

I began the week by implementing a Comparator component, which takes two inputs (A and B) and provides three outputs:

  • greater (when A > B),
  • equal (when A == B), and
  • less (when A < B).

Internally, the resolve() method handles this comparison logic, and results are forwarded to the simulation queue. I also used the fillText4 method to draw appropriate comparison symbols on the canvas for clarity.

Comparator Component

After implementation, I tested the component thoroughly to ensure correctness across bit-widths and edge cases.

Unfortunately, I was unwell for a day after finishing the Comparator, which slightly affected the pace of progress. However, I was able to resume soon after and complete the remaining work.

Pull Resistor Component

Following that, I designed and implemented a Pull Resistor component. This component forces a floating input to either logic high (Pull-Up) or logic low (Pull-Down) based on the selected configuration. To make this configurable, I introduced a pullDirection property and allowed users to switch it via a dropdown.

Initially, CircuitVerse did not support dropdown input type in mutableProperties, so I extended the simulator UI to support dropdowns. This involved modifying the Vue template that renders object properties, enabling reusable dropdown support for future components as well.

Pull Resistor Component

To simulate pull resistors accurately, I relied on the simulator’s use of undefined to represent floating (undriven) nodes. The Pull Resistor component monitors its connected input and asserts a logic level — either high (1) or low (0) — only when the input is floating. This design ensures that the resistor doesn’t interfere with actively driven signals, come into play only when no other signal is present on the line.

Looking ahead to Week 3 with more implementation and refinements in mind.

Top comments (0)