Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions docs/chapter4/2input.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,29 +118,57 @@ You can verify the behavior of the **Stepper** circuit element in the live circu
allowFullScreen
></iframe>



## Random

The **Random** circuit element generates a random value in the range (0, maxvalue) every time it receives a HIGH signal from the clock. It has 3 ports in total:
The **Random** circuit element is used to generate pseudo-random numerical values during simulation. It produces a new random value in the range **0 to MaxValue** whenever it receives a HIGH signal from the clock input.

This element is useful for simulating unpredictable inputs, modeling random events, and testing circuits under varying input conditions.

### Ports

The Random element has three ports:

- **Max Value**:
An input port that defines the upper bound of the generated random number. The output value will always lie between `0` and `MaxValue`.

- **Max Value**: input, maximum value generated.
- **Clock**: input clock element. Every time the clock receives a HIGH input, the random element generates a number.
- **Random Value**: output, the number generated.
- **Clock**:
An input port that triggers value generation. Each time the clock transitions to HIGH, the Random element generates a new random number.

The value is also displayed in decimal notation on the random element.
- **Random Value**:
An output port that provides the generated random number to the connected circuit components.

### Behavior

- A new value is generated only when the **Clock** receives a HIGH signal.
- The generated value is displayed directly on the element in **decimal notation**.
- The output respects the specified **BitWidth** of the circuit.
- If the Max Value is changed during simulation, subsequent outputs follow the updated range.

### Applications

The Random element can be used to:

- Simulate sensor noise or unpredictable signals
- Test combinational and sequential logic circuits
- Demonstrate probability-based digital systems
- Create randomized test patterns

You can verify the behavior of the **Random** circuit element in the live circuit embedded below:

<iframe
width="600px"
height="400px"
src="https://circuitverse.org/simulator/embed/12041"
src="https://circuitverse.org/simulator/embed/REPLACE_WITH_PROJECT_ID"
id="projectPreview"
scrolling="no"
webkitAllowFullScreen
mozAllowFullScreen
allowFullScreen
></iframe>


## Counter

The **Counter** circuit element is a binary counter that runs from zero to a specified maximum value. It has five ports in total:
Expand Down
70 changes: 65 additions & 5 deletions docs/chapter4/3output.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,52 @@ You can verify the behavior of the **RGBLED** circuit element in the live circui

## SquareRGBLED

While the **SquareRGBLED** works similarly to the **RGBLED**, the **SquareRGBLED** differs in its shape and includes pin lengths that can be customized in the **PROPERTIES** panel. These additional features make **SquareRGBLEDs** ideal for simulating arrays of pixels.
The **Square RGB LED** circuit element is a visual output component that displays different colors based on three digital input signals: Red, Green, and Blue.

> Properties that can be customized in the **PROPERTIES** panel include: **Pin Length**
This element is commonly used to represent multi-signal outputs in a compact and intuitive way.

The live circuit embedded below illustrates how an array of pixels may be programmed to display an image. The circuit design includes a LED buffer subcircuit that manages the circuitry controlling the LEDs. The ability to vary the pin length of the square RGB LED element makes the design clean and easy to read. To make the design more comprehensible, the pins for different square LEDs must remain in the same vertical order as the LEDs themselves (i.e. the top pins must correspond to the top LED).
### Ports

The Square RGB LED has three input ports:

- **R (Red)** – Controls the red channel.
- **G (Green)** – Controls the green channel.
- **B (Blue)** – Controls the blue channel.

### Behavior

Each input controls one color channel. When multiple inputs are HIGH, the colors combine to form secondary colors:

| R | G | B | Output Color |
|---|---|---|--------------|
| 1 | 0 | 0 | Red |
| 0 | 1 | 0 | Green |
| 0 | 0 | 1 | Blue |
| 1 | 1 | 0 | Yellow |
| 1 | 0 | 1 | Magenta |
| 0 | 1 | 1 | Cyan |
| 1 | 1 | 1 | White |

The LED changes color instantly during simulation depending on the input combination.

### Applications

- Displaying status signals
- Visual debugging of logic circuits
- Representing multi-bit outputs in an intuitive format

You can verify the behavior of the **Square RGB LED** circuit element in the live circuit embedded below:

<iframe
width="600px"
height="400px"
src="https://circuitverse.org/simulator/embed/11345"
src="https://circuitverse.org/simulator/embed/REPLACE_WITH_PROJECT_ID"
id="projectPreview"
scrolling="no"
webkitAllowFullScreen
mozAllowFullScreen
allowFullScreen
>
{" "}
</iframe>

## HexDisplay
Expand Down Expand Up @@ -202,6 +231,37 @@ As opposed to the **HexDisplay** and **SevenSegDisplay** circuit elements, the m

## RGB Led Matrix

The **RGB LED Matrix** circuit element consists of multiple RGB LEDs arranged in a grid structure. Each LED (pixel) contains Red, Green, and Blue channels that can be controlled individually.

This allows the matrix to display structured patterns and graphical outputs.

### Behavior

- Each pixel contains three color channels (R, G, B).
- Different combinations of inputs produce different colors.
- Multiple pixels together allow pattern and visual display generation.
- Updates dynamically during simulation.

### Applications

- Displaying patterns and symbols
- Creating graphical simulations
- Demonstrating matrix addressing concepts
- Educational visualization of digital outputs

You can verify the behavior of the **RGB LED Matrix** circuit element in the live circuit embedded below:

<iframe
width="600px"
height="400px"
src="https://circuitverse.org/simulator/embed/REPLACE_WITH_PROJECT_ID"
id="projectPreview"
scrolling="no"
webkitAllowFullScreen
mozAllowFullScreen
allowFullScreen
></iframe>

The **RGB Led Matrix** element represents a rectangular array of RGB pixels and is ideal for simulating programmable LED matrices and pixel displays. Each pixel stores a 24-bit color (8 bits per red, green and blue channels).

Key ways to set pixels:
Expand Down
104 changes: 103 additions & 1 deletion docs/chapter4/8misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ description: "Misc page in Chapter4 of CircuitVerse documentation."
9. [Unequal Split](#unequal-split)
10. [Flag](#flag)
11. [Two's Complement](#twos-complement)

12. [Force gate](#force-gate)
13. [TB Input](#tb-input)
14. [TB Output](#tb-output)
## ALU

An **Arithmetic Logic Unit** (ALU) circuit element is a combinational digital electronic circuit that performs arithmetic and bitwise operations on integer binary numbers. Figure 4.15 highlights the different ports in the ALU circuit element available within CircuitVerse and Table 4.19 provides a brief description of the different ports.
Expand Down Expand Up @@ -571,3 +573,103 @@ You can verify the behavior of the **Two’s Complement** circuit element in the
mozAllowFullScreen
allowFullScreen
></iframe>

## Force Gate

The **Force Gate** circuit element is used to override an incoming signal and force the output to a fixed logic value.

It is mainly used during debugging and testing to maintain a specific logic state in the circuit.

### Behavior

- Forces output to either `HIGH (1)` or `LOW (0)`.
- Ignores the actual incoming signal when active.
- Useful for maintaining constant states in complex designs.

### Applications

- Debugging large circuits
- Forcing reset or control conditions
- Testing specific signal paths

You can verify the behavior of the **Force Gate** circuit element in the live circuit embedded below:

<iframe
width="600px"
height="400px"
src="https://circuitverse.org/simulator/embed/REPLACE_WITH_PROJECT_ID"
id="projectPreview"
scrolling="no"
webkitAllowFullScreen
mozAllowFullScreen
allowFullScreen
></iframe>
Comment on lines +577 to +606
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

rg -n "REPLACE_WITH_PROJECT_ID" --glob 'docs/chapter4/*.md'

Repository: CircuitVerse/CircuitVerseDocs

Length of output: 677


🏁 Script executed:

# Check docs/chapter4/8misc.md around the placeholder lines
cat -n docs/chapter4/8misc.md | sed -n '570,610p'

Repository: CircuitVerse/CircuitVerseDocs

Length of output: 1348


🏁 Script executed:

# Check what sections have placeholders in 8misc.md
cat -n docs/chapter4/8misc.md | sed -n '630,675p'

Repository: CircuitVerse/CircuitVerseDocs

Length of output: 1518


🏁 Script executed:

# Check docs/chapter4/2input.md around line 163
cat -n docs/chapter4/2input.md | sed -n '155,170p'

Repository: CircuitVerse/CircuitVerseDocs

Length of output: 598


🏁 Script executed:

# Check docs/chapter4/3output.md around lines 154, 257
cat -n docs/chapter4/3output.md | sed -n '145,165p'
cat -n docs/chapter4/3output.md | sed -n '250,265p'

Repository: CircuitVerse/CircuitVerseDocs

Length of output: 1660


Replace all placeholder project IDs with actual CircuitVerse project IDs across the documentation.

Six embedded CircuitVerse circuits contain REPLACE_WITH_PROJECT_ID placeholders that must be replaced with valid project IDs:

  • docs/chapter4/8misc.md: Force Gate (line 600), TB Input (line 636), TB Output (line 669)
  • docs/chapter4/2input.md: Random (line 163)
  • docs/chapter4/3output.md: Square RGB LED (line 154), RGB LED Matrix (line 257)

Create the corresponding demo circuits on CircuitVerse and update all six placeholders with their respective project IDs.


---

## TB Input

The **TB Input** circuit element represents the input side of a Tri-State Buffer. It is used in circuits where multiple devices share a common communication line.

### Ports

- **Data Input**
- **Enable**

### Behavior

- When **Enable = HIGH**, the input signal is passed forward.
- When **Enable = LOW**, the output enters a High-Impedance (Z) state.
- High-Impedance disconnects the element from the shared line, preventing interference.

### Applications

- Shared bus systems
- Memory and processor communication
- Preventing signal conflicts

You can verify the behavior of the **TB Input** circuit element in the live circuit embedded below:

<iframe
width="600px"
height="400px"
src="https://circuitverse.org/simulator/embed/REPLACE_WITH_PROJECT_ID"
id="projectPreview"
scrolling="no"
webkitAllowFullScreen
mozAllowFullScreen
allowFullScreen
></iframe>

---

## TB Output

The **TB Output** circuit element represents the output side of a Tri-State Buffer.

It allows a signal to either drive a shared line or remain electrically disconnected.

### Behavior

- Outputs the signal when enabled.
- Outputs High-Impedance (Z) when disabled.
- Prevents bus contention when multiple outputs are connected to the same wire.

### Applications

- Bidirectional communication lines
- Bus architectures
- Peripheral interfacing

You can verify the behavior of the **TB Output** circuit element in the live circuit embedded below:

<iframe
width="600px"
height="400px"
src="https://circuitverse.org/simulator/embed/REPLACE_WITH_PROJECT_ID"
id="projectPreview"
scrolling="no"
webkitAllowFullScreen
mozAllowFullScreen
allowFullScreen
></iframe>