Tuesday, August 30, 2011

Building a DMux

A DMUX is the opposite of MUX. It recieves one input and based on the value of the selector bit, it routes that input to one of two output lines.


Looking at the image above, if sel is 0, then the value of 'in' will be routed to O0, and if sel is 1, then the value of 'in' will be routed to O1.

To achieve this, we can AND 'in' with '`sel', sending that output to O0. We also AND 'in' with 'sel', sending that output to O1.




Monday, August 29, 2011

Mux

A Multiplexer (MUX) is basically a selector. It has two input pins and a selector pin. Based on the selector, it selects one of the input pins.


If the selector is 0, then 'a' is selected, and if selector is 1, then 'b' is selected.

Let's start with an Axiom. Anything ANDed with 1 will result in that thing. So, 'a' AND 1 = 'a'

If we AND 'a' with NOT(selector), then the output of that AND gate (let's call it a1) will be 'a' if selector is 0. Similarly, if we AND 'b' with the selector, then the output of that AND gate (let's call it a1) will be 'b' if the selector is 1.

But along with this, we actually have to implement a conditional. If selector is 0, then 'a', else 'b'. The way to implement conditionals with logic gates is using the OR gate.

Now, if selector is 0, then 'a1' will carry the value of 'a', and 'a2' will carry 0. If selector is 1, then 'a1' will carry 0, and 'a2' will carry, the value of 'b'. Thus if we perform a1 OR a2, then we will get the correct answer.






Xor chip

Built an Xor chip

Or Chip

I have built the Or chip.

Sunday, August 28, 2011

And Chip

Completed the And chip

Remember:
If there is a bug in the hdl program, such as incorrectly naming a part, it will simply not load the chip, but will not throw any errors.


Not chip

Completed the Not chip

Some basic notes for chapter 1

I have started reading chapter 1, and am having an absolutely awesome time re-learning so many of these things. Honestly, I had no clue how much I had forgotten.

In this blog post, I am going to enter a few notes, and document my my process of understanding various concepts I come across in this chapter.

Fact 1:
The simplest way to specify a boolean function is to enumerate all the possible values of the function's input variables along with the function's output for each set of input. This is also known as the truth table.

Fact 2:
Every boolean function can be represented with what is known as a Canonical representation. The truth table below represents a function with 3 variables.




xyzf(x,y,z)
0000
0010
0101
0110
1001
1010
1101
1110



To get the canonical function, we have to OR all the rows which have 1 as the result. From the table above the canonical function will be:

f(x,y,z) = ^xy^z + x^y^z + xy^z

This shows, that all functions can be represented with a combination of AND, OR, and NOT

Fact 3 (with some sense making):
The book states in the last paragraph of page 9 - "the number of boolean functions that can be defined with n binary variables is 2^2^n". I had a hard time understanding this at first. But them I realized that n variables will lead to 2^n combinations (rows), and if we assume each row as a variable, then it is possible to have 2^2^n truth tables. Since each truth table is a function, we can say that for n variables, we can have 2^2^n functions.

Fact 4:
The NAND and NOR functions have an interesting theoretical property. Each of the functions AND, OR, and NOT, can be constructed using either NAND or NOR functions. And since any function can be represented using AND, OR, NOT (see fact 2), we can represent any function using only NAND, or NOR function.


Saturday, August 27, 2011

Download and install the TECS hardware simulator


I downloaded the TECS software and unzipped it in ~/bin/tecs

Next, I ran HWSimulator.sh to check if the Hardware Simulator is working. It ran just fine, so I loaded the NAND chip ($TECS_HOME/builtInChips/NAND.HDL), and that too loaded fine.