chipdev

chipdev.io Solutions (0x6A73)
git clone https://git.pngu.org/chipdev
Log | Files | Refs | README

readme.md (1431B)


Simple Router

Prompt

Build a router circuit which forwards data from the input (din) to one of four outputs (dout0, dout1, dout2, dout3), specified by the address input (addr)

The address is a two bit value whose decimal representation determines which output value to use. Append to dout the decimal representation of addr to get the output signal name dout{address decimal value}. For example, if addr=b11 then the decimal representation of addr is 3, so the output signal name is dout3.

The input has an enable signal (din_en), which allows the input to be forwarded to an output when enabled. If an output is not currently being driven to, then it should be set to 0.

Input & Output Signals

Example:

# Simple Router

## Prompt
Build a router circuit which forwards data from the input (`din`) to one of four outputs (`dout0`, `dout1`, `dout2`, `dout3`), specified by the address input (`addr`)

The address is a two bit value whose decimal representation determines which output value to use. Append to `dout` the decimal representation of `addr` to get the output signal name `dout{address decimal value}`. For example, if `addr=b11` then the decimal representation of `addr` is 3, so the output signal name is `dout3`.

The input has an enable signal `(din_en)`, which allows the input to be forwarded to an output when enabled. If an output is not currently being driven to, then it should be set to 0.

## Input & Output Signals
- `din`: Input data.
- `din_en`: Enable signal for `din`. Forwards data from input to an output if 1, does not forward otherwise.
- `addr`: Two bit destination address. For example `addr = b11 = 3` indicates `din` should be forwarded to output value 3 (`dout3`).
- `dout0`: Output 0. Corresponds to `addr = b00`.
- `dout1`: Output 1. Corresponds to `addr = b01`.
- `dout2`: Output 2. Corresponds to `addr = b10`.
- `dout3`: Output 3. Corresponds to `addr = b11`.

## Example:
- Data width: 32
- Input 1
    - `din = hbee`
    - `din_en`: True
    - `addr = h1`
- Input 2
    - `din = hbee`
    - `din_en`: True
    - `addr = h3`
- Input 3
    - `din = hbee`
    - `din_en`: False
    - `addr = h3`