-
Notifications
You must be signed in to change notification settings - Fork 272
add documentation for bit extender component #431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ description: "Misc page in Chapter4 of CircuitVerse documentation." | |
| 8. [Unequal Split](#unequal-split) | ||
| 9. [Flag](#flag) | ||
| 10. [Two's Complement](#twos-complement) | ||
| 11. [Bit Extender](#bit-extender) | ||
|
|
||
| ## ALU | ||
|
|
||
|
|
@@ -519,3 +520,56 @@ You can verify the behavior of the **Two’s Complement** circuit element in the | |
| mozAllowFullScreen | ||
| allowFullScreen | ||
| ></iframe> | ||
|
|
||
| ## Bit Extender | ||
|
|
||
| The **Bit Extender** is a combinational digital circuit component that extends an input binary value to a specified larger bit width. It supports multiple extension strategies such as **zero-extension**, **sign-extension**, **one-extension**, and **custom input extension**. | ||
|
|
||
| This is useful in arithmetic operations and situations where bit width alignment is required between components. | ||
|
|
||
| > Properties that can be customized in the **PROPERTIES** panel include: `Bit Width In`, `Bit Width Out`, `Extension Type`, `Direction` | ||
|
|
||
| --- | ||
|
|
||
| ### Bit Extender Ports | ||
|
|
||
| | **Name** | **Description** | | ||
| |-------------------|-----------------| | ||
| | `Bit Width In` | Input value to be extended | | ||
| | `Bit Width Out` | Output after extension | | ||
| | `input` (optional) | Used only when `Extension Type = Input`; specifies the extension bit | | ||
|
|
||
| --- | ||
|
|
||
|  | ||
| *Figure 4.25: Relevant attributes for the Bit Extender circuit element* | ||
|
|
||
| --- | ||
|
|
||
| ### Behavior | ||
|
|
||
| If the **input width** (`Bit Width In`) is less than the **output width** (`Bit Width Out`), the remaining bits are filled based on the selected extension strategy: | ||
|
|
||
| | **Extension Type** | **Filler Bits** | | ||
| |--------------------|---------------------------------------------------------------| | ||
| | `Zero` | All extra bits are set to `0` | | ||
| | `One` | All extra bits are set to `1` | | ||
| | `Sign` | Fills with the **most significant bit** of the input (sign bit)| | ||
| | `Input` | Fills with the value of an external **input node** | | ||
|
|
||
| If the input bit width is **greater than** the output, the input is **truncated from the MSB side**. | ||
|
|
||
| --- | ||
|
|
||
| ### Example | ||
|
|
||
| - `Bit Width In = 4`, `Bit Width Out = 8` | ||
| - Input: `1011` | ||
| - Extension Type: `Sign` | ||
|
|
||
| The MSB is `1`, so the output becomes: `11111011` | ||
|
|
||
| ### Embedded Circuit | ||
|
|
||
| <!-- **[Pull Resistor Simulation](https://circuitverse.org/simulator/embed/TODO)** --> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove or replace the placeholder embed link -<!-- **[Pull Resistor Simulation](https://circuitverse.org/simulator/embed/TODO)** -->
+<iframe
+ width="600px"
+ height="400px"
+ src="https://circuitverse.org/simulator/embed/<project_id>"
+ id="projectPreview"
+ scrolling="no"
+ webkitAllowFullScreen
+ mozAllowFullScreen
+ allowFullScreen
+></iframe>
🤖 Prompt for AI Agents |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ports vs. properties are conflated – revise column names
Bit Width InandBit Width Outare configurable properties, not electrical ports. Presenting them in a “Ports” table is misleading. Typically the Bit Extender exposes one input port (e.g.In) and one output port (e.g.Out), plus an optionalinputport whenExtension Type = Input.Suggested minimal fix: rename the table to “Configurable Properties & Optional Port” and separate the true port(s):
📝 Committable suggestion
🤖 Prompt for AI Agents