Skip to content

COMP311/useful_digital_components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Useful Digital components

This document explains useful components in Digital.

Contents

Tunnel

The Tunnel component (Components > Wires > Tunnel) will save you a lot of time debugging by simplifying your circuit wiring.

A tunnel is like an invisible wire between two points. For example, these two circuits are logically equivalent:

Perhaps this doesn't immediately seem useful. However, consider the following two circuits, one without tunnels and one with tunnels:

The two circuits are logically equivalent, but the latter is clearly easier to construct, read, and debug.

All tunnels with the same name (which you can set by right-clicking the Tunnel) are connected and have the same value.

Please use tunnels when constructing circuits!

Splitter/merger

In the first few labs, we will see only 1-bit values on inputs, outputs, and wires. However, multi-bit values are common. For example, a 32-bit number in your computer can be represented as 32 wires that each carry 1 bit. However, we do not want to draw 32 wires, and it is preferable to draw a single wire that denotes 32 bits.

Here is an example in Digital. First, we create an input component and set it to 2-bit.

Then we use the splitter/merger component (Components > Wires > Splitter/Merger). For example,

While simulating, we set the input's value to 0b10. The wire from the input component contains both bits. This wire is connected to the splitter/merger's input dot, and the 2-bit wire is split into two wires that each contain 1 bit. Note that bit1 is on and bit0 is off, as expected.

In general, the splitter/merger component can split a multi-bit value into smaller parts or merge multiple values into a single value. To be concise, we'll use the term "splitter" from now on, but you should remember that it can both split and merge.

Here's another example, in which we split a 32-bit input into four separate bytes.

The splitter is configured as follows:

The input is 32-bit, so we set "Input Splitting" to 32, which creates the blue input dot labeled 0-31 on the splitter. For four groups of 8 bits, we set "Output Splitting" to "8,8,8,8". This creates four red output dots labeled 24-31, 16-23, 8-15, and 0-7 on the splitter. To see more details about the syntax of the "Input Splitting" and "Output Splitting" fields, right click a splitter/merger and click "Help". Lastly, all outputs are 8-bit.

Ungraded exercise

Note: This exercise is not graded and is purely for you to confirm whether or not you understand this section.

To test your understanding of this section, open splitter.dig. This file contains a 10-bit input displayed in binary format and a 1-bit output. Do not change the bit widths of the input or output. You may change the number format, though this is unnecessary.

In this file, create a circuit that outputs 1 if the 10-bit input is negative and odd when interpreted as a 2's complement number. Otherwise, the output should be 0.

Testing

See the Lab 0 instructions for testing a circuit in Digital.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published