User Tools

Site Tools


opus:spring2012:tgalpin2:asmpart1

asm Keywords

Logical Operators

Definition

A Logical Operator is a “connector” of sorts between two items with value, which then in turn yields a truth value based on the truth value of those two items. In relation to the course, this would of course reference the electrical signals sent through the processor (on and off, 1 and 0, etc.).

The logical operator AND takes two items and will only yield a truth value of true if both of those items also have a truth value of true. In the scope of the course, this means a couple things– of course, we use AND as “&&” in C/C++ code for a conditional statement. In terms of a processor, AND will only yield an on signal if both input signals are on, so to speak.

The logical operator OR will yield a true value so long as one of the inputted truth values is also true. In relation to the course, we also use this operation in our code, as shown by the “||” operator in C/C++. In terms of the hardware, an on signal is sent when one or two on signals is received.

The logical operator XOR is the exclusive or operation. This means that it is a lot like OR, except that it will only yield a true value if and only if one of the two truth values are true. That is to say, having both values be true will not yield a true value under XOR.

Demonstration

As we know, some examples of logical operators include AND, OR and XOR.

If we were to make a small bitwise truth table to demonstrate these concepts, it would look like this–

     A O X 
     N R O
     D   R
--------------------
1 1 |1 1 0
1 0 |0 1 1
0 1 |0 1 1
0 0 |0 0 0

Here is a code snippet of AND being used in C:

//AND in C
if( x == 1 && y == 1)
{
   exampleFunction();
}
 
//OR in C
if( x == 1 || y == 1)
{
    exampleFunction();
}
 
//XOR in C
if( (x == 1 && y == 0) || (x == 0 && y == 1) )
{
   exampleFunction();
}

Negated Logic Operator

Definition

A negated logic operator is precisely what it sounds like– it takes our standard logic operator, and essentially negates them in the sense that it yields true values based on whether or not given truth values are false. They could be called opposites of the regular logic operators. Examples include NOR, NAND, XNOR, and NOT.

NOR yields a true value if and only if no given conditions are true. It is the inverse of OR.

NAND yields a true value if one given condition is not true. The yielded value is false if both given are true. It is the inverse of AND.

XNOR is exclusive NOR. It yields true only if both given conditions are true, or both are false. It is the inverse of XOR.

NOT simply inverts the given truth values (usually in the form of bits). True becomes false, false becomes true.

As is such, every negated logic operator is essentially a logic operator put through NOT.

Demonstration

       N X    |               |
     N A N    |               |
     O N O    |               |
     R D R    | NOT Inversion |
-------------------------------
1 1 |0 0 1    |1| -> 0
1 0 |0 1 0    |1| -> 0
0 1 |0 1 0    |1| -> 0
0 0 |1 1 1    |0| -> 1
//NAND in C
if(!(x == 1 && y == 1))
{
   exampleFunction();
}
 
//NOR in C
if(!(x == 1 || y == 1))
{
    exampleFunction();
}
 
//XNOR in C
if(!((x == 1 && y == 0) || (x == 0 && y == 1)))
{
   exampleFunction();
}

Storage

Definition

Storage is simply the various parts of the computer that are used to store the digital data that is used and created. This can refer to many things, including hard disks, RAM, registers, solid state drives and more.

It is worth noting that there are varying degrees, so to speak of storage. That is, there is primary, secondary, tertiary and off-line.

Primary storage is can be accessed directly by the CPU. An example of this would be RAM.

Secondary storage is non-volatile and can't be accessed by the CPU directly. An example would be a hard disk drive.

Tertiary storage is usually used for archiving, as it takes much longer to access than secondary storage. An example would be a tape cartridge.

Off-line storage is storage independent of a processing unit. An example would be a an optical disc drive.

Demonstration

Registers (General Purpose/Integer, Floating Point, Accumulator, Data)

Definition

Simply, a register is a small amount of storage on the processor that contains instructions for completing simple or commonly used tasks. With these instructions being stored in a storage location on the processor, it is much easier to access, which makes these processes quicker.

Data registers can hold data in the form of integers and floating point values. Older CPUs, like the one we seek to emulate, have a special register called an accumulator that deals with that data specifically.

Demonstration

register_7.jpg

A 4-bit register. [Source: http://cpuville.com/register.htm]

Address Bus

Definition

Before defining this word, it is important to understand what a bus is. Simply, it is a subsystem that forms a connection between components for the transfer of various forms of data.

Now, an Address Bus is the bus that is used to specifically address a memory location. That is to say, when one component (say the CPU) needs to access data, the memory address of this data is transmitted through the address bus.

Demonstration

Data Bus

Definition

Before defining this word, it is important to understand what a bus is. Simply, it is a subsystem that forms a connection between components for the transfer of various forms of data.

The Data Bus is the bus on which a certain value is transmitted. To put it in perspective, if the the address bus transmits a memory location, the data bus transmits the value stored in this memory location.

Demonstration

Below is a system bus, highlighting how each specific bus interfaces with the other components of the computer.

<html> <img src=“http://upload.wikimedia.org/wikipedia/commons/thumb/6/68/Computer_system_bus.svg/400px-Computer_system_bus.svg.png”> </html>

[Source: Wikipedia: Bus (computing)]

Control and Data Flow

Definition

Control Flow refers to the order or method by which instructions are carried out by the computer. This encompasses the types of conditional statements and functions (subroutines) that we would see in our programming code.

Data Flow, on the other hand, refers to the stream of information that is passed around the computer's components. It is not concerned with how and when like control flow, but rather where and what.

Demonstration

<html> <img src=“http://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Performance_seeking_control_flow_diagram.jpg/454px-Performance_seeking_control_flow_diagram.jpg” height=500> </html>

Above is an example of control flow, in diagram form. Obviously, the diagram has subject matter not pertaining to computer science, but the logic of control flow is there, which is the focus. [Source: Wikipedia: Control Flow diagram]

<html> <img src=“http://upload.wikimedia.org/wikipedia/commons/thumb/c/c8/DataFlowDiagram_Example.png/360px-DataFlowDiagram_Example.png”> </html>

Above is an example of data flow, in diagram form [Source: Wikipedia: Data Flow diagram]

Boolean Arithmetic Operations

Definition

Boolean Arithmetic Operations are algebraic operations that are used on boolean or binary values. The typical operations of addition, subtraction, multiplication and division are either fundamentally different or non-existent in the scope of boolean algebra. To explain the latter, it is worth knowing that there is no such thing as subtraction, as that would require negative numbers, and division, as it is compounded subtraction just as multiplication is compounded addition, in boolean algebra.

Luckily, addition and multiplication still exist, though this is self-evident. Simply, boolean addition will yield a 1 or true value so long as there is a 1/true value being added. Multiplication will yield a 1/true value if and only if there are no zeros involved.

Demonstration

Below are some examples of boolean addition and multiplication. As you can see, they use standard mathematical notation, logic gate representation and circuitry representation.

Addition <html> <p> <img src=“http://sub.allaboutcircuits.com/images/14009.png” height=100> </p>

<p>

</p>

<p> <img src=“http://sub.allaboutcircuits.com/images/14010.png” height=100> </p>

<p>

</p>

<p> <img src=“http://sub.allaboutcircuits.com/images/14011.png” height=100> </p>

<p>

</p>

<p> <img src=“http://sub.allaboutcircuits.com/images/14012.png” height=100> </p>

<p> </html>

Multiplication <html> <p> <img src=“http://sub.allaboutcircuits.com/images/14013.png” height=75> </p>

<p>

</p>

<p> <img src=“http://sub.allaboutcircuits.com/images/14014.png” height=75> </p>

<p>

</p>

<p> <img src=“http://sub.allaboutcircuits.com/images/14015.png” height=75> </p>

<p>

</p> <p> <img src=“http://sub.allaboutcircuits.com/images/14016.png” height=75> </p>

<p> </html>

[Source: Boolean arithmetic -- allaboutcircuits.com]

asm Objective: Understanding the Impact of Number Systems

Definition

Personally, I think that meeting this objective means having a thorough understanding of how the various number systems we use (binary, octal, decimal, hexidecimal, etc.) in computer science work, along with an appreciation of how they let us solve problems and think of situations in different ways.

Method

I'm not sure if there is any one test that would prove that I have met this objective, but I do think that a small discussion about the topic in the below space should suffice.

Measurement

Suffice it to say, number systems have a profound impact on our field, computer science, and an understanding of such is integral to our success. As previously stated, using different number systems lets us look at problems in different ways. Thinking in terms of a different number system may help one understand how a certain component or program works.

The main number systems covered in our course thus far (decimal, binary, octal and hexadecimal) all have their place in computer science and in the very computers we work with. Chief among these number systems would be binary, as it is the representation of how the hardware works at the most basic level, which is to say the electrical signals being sent in the circuitry. One would not get very far as in this class, let alone as a CS major, without understanding the implications of the binary number system.

Another important system would be hexidecimal, which is often used in addressing memory locations, and, in a less pertinent matter, the colors displayed in our programs and web pages.

Generally speaking, understanding that numbers can be looked at in a different way than we grew up with in decimal speaks to a larger message that all computer science majors should abide by. That message is of course that with computing, there is always more than one way to get the job done.

Analysis

Upon further analysis, I do believe I get it.

bool numberSystems;
bool important = true;
numberSystems = important;
while(numberSystems == important)
{
  tylerGetsIt(numberSystems, important);
}
opus/spring2012/tgalpin2/asmpart1.txt · Last modified: 2012/05/10 02:08 by tgalpin2