Table of Contents

asm Keywords

asm Keyword 1: Rgisters Part One

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

Definition

Registers are a small amount of storage used by a processor. They are like a series of data boxes that can be used to store data for use for arithmetic, manipulation, or testings by some machine instruction. They allow processors quick-access of pieces of memory they may use frequently, allowing for quick access because the processor doesn't have to continually fetch that data from the hard-disk or RAM.

Accumulator

An accumulator is a type of register that allows for quick storage and access of data that was used for arithmetic, or is created as result of arithmetic. Without accumulators the CPU would have to write each arithmetic action to the main memory storage, only to sometimes be immedietely re-used for something else, causing the processor to access the main memory more than needed.

asm Keyword 2: Registers Part Two

Registers (Stack Pointer, Program Counter, Flag/Status)

Definition

Stack Pointer

A stack pointer is a special type of register that points to the top of the stack. This thpe of register is usually called a Frame Pointer and is set up to point to a fixed location in the frame structure.

Program Counter

A program counter is a processor register that tells the computer where it is in it's instruction sequence. This type of register can hold either the memory address or the current instruction to be executed, or the next instruction to be executed. This register is usually incremented automatically after a program instruction is grabbed, this makes the cpu retrieve instructions sequentially from memory.

These memory addresses can contain jump instructions and returns which allow the set sequence to be interupted by telling the cpu to look at a new memory location for it's next access point.

flag/status

This type of register is a collection of flag bits for a processor. It contains information about the process state. Individual bits are read and/or written by the instruction execution on the processor. A status register can have many fields, but the classic design includes at least these three: Zero, Carry, and Overflow.

The most common flags
ZZero FlagIndicates that the result of an arithmetic or logical operation (or, sometimes, a load) was zero.
CCarry FlagEnables numbers larger than a single word to be added/subtracted by carrying a binary digit from a less significant word to the least significant bit of a more significant word as needed. It is also used to extend bit shifts and rotates in a similar manner on many processors (sometimes done via a dedicated X flag).
S/NSign flag / Negative flag Indicates that the result of a mathematical operation is negative. In some processors,[1] the N and S flags are distinct with different meanings and usage: One indicates whether the last result was negative whereas the other indicates whether a subtraction or addition has taken place.
V/O/WOverflow flagIndicates that the signed result of an operation is too large to fit in the register width using twos complement representation.
PParity flagIndicates whether the number of set bits of the last result is odd or even.

asm Keyword 3: Register Part Three

Registers (Index/Pointer)

Definition

An index register is found in the CPU and is used for modifying operand addresses during a program, usually for vector or array operations. This process register is used for indirect addressing where an immediate constand is forced into the contents of a register to form the address to the actual operand or data.

This type of register was implemented around 1955-1964.

asm Keyword 4: Logic Operations

AND, OR, XOR

Definition

Logical operations are called boolean logic, a logic of truth values. The boolean algebra laws can be defined axiomatically because axioms, along with there theorems provide for every possible assignment of 0 or 1 to their given variables.

This is because boolean algebra is based around the thought of two variables. usually taken to be T & F or 0 & 1. To understand this boolean logic, it really doesnt matter if you use T&F, 1&0, or Sneeches w/ stars and Sneeches w/o stars, as long as you have 2 independant variables.

AND

The AND operation can be thought of as multiplication. when you multiply 0 by 0, what do you get? 0. when you multiply 1 by 0, what do you get? 0. 1 by 1? 1. That is the basis behind an AND gate, and this logic develops a truth table like so.

ABoutput
111
100
010
000
OR

The OR operation can be though of as addition, sorta ;). When you add 0 to 0 you get 0, 1 to 1 you get 1, 0 to 1 you get 1. In any case this means that if A, B or AB is 1, you get a one.

ABoutput
111
101
011
000
XOR

Not sure how to explain this one mathmatically, but it works like this. If A or B is 1 but not both, then the output is one. Else the output is 0.

ABoutput
110
101
011
00

asm Keyword 5: Logical Operations cont.

NOT, NAND, NOR, XNOR

Definition

A negated operation. The output of this operation is the opposite of its non-negated couterpart. Look at keyword 4 :p

NOT

A NOT operation is the basis behind a negated operation. This basically means that if the input was one thing, it comes out the other. If you put in a 1, you get a 0. Put in a 0, get a one.

Aoutput
10
01

A NAND operation, as well as NOR and XNOR build on the the not operation.

NAND
ABoutput
110
101
011
001
NOR
ABoutput
110
100
010
001
XNOR
ABoutput
111
100
010
001

asm Keyword 6: Boolean Arithmetic

Boolean Arithmetic Operations (Addition, Subtraction, Multiplication, Division)

Definition

Boolean algebra is a type of arithmetic based off from two variables. The operations to be discussed are addition, subtraction, multiplication and division.

Let's start with subtraction because in boolean algebra, it doesn't exist. The existance of subtraction implies the existance of negative numbers, which are a no no in boolean.

Division, like subtraction, doesn not exist either. The reason for this is because division is really just compunded subtraction, like multiplication is compounded addition.

Addition does exist, it's not like boolean algebra is some messed up alternate reality, it is just a better reality where life is much more simple.

With that beaing said, boolean addition works like so: 0 + 0 = 0 (ok, so far so good) 0 + 1 = 1 (I think i can handle this Pre-k math) 1 + 1 = 1 (Say Whaaaaaaat?) 1 + 1 + 0 + 1 = 1 (someone's been on the bottle)

Because boolean algebra is made up of just 1's and 0's, there is no 2 or 3. Thefore when we add 1 + 1, it can't be zero, so it has to be one by process of elimination.

Multiplication also exists, and makes perfect sence. 0 x 0 = 0 1 x 0 = 0 1 x 1 = 1 Simple as that.

Boolean algebra though does not tend to use 1's and 0's, it uses letters, normally A and B.

asm Keyword 7: instruction sets

Instruction Sets (CISC, RISC)

Definition

Complex instruction set computer or reduced instruction set computer is a type of computer when one instruction can run multiple low-level operations such as arithmetic or memory storage and retrieval.

Demonstration

Demonstration of the chosen keyword.

Instruction: store A +B in A. Operations involved:

  1. retrieve A
  2. retrieve B
  3. add A + B
  4. store answer in A

And even so many other sub-operations are going on inside of operations like add A+B because register called accumulators are involved in storing A and B and their result as things are manipulated.

asm Keyword 8: Subroutines

Subroutines (Calling, Return Address)

Definition

A subroutine is a snippet of code within a larger program that executes one specific task that is entirely dependant of the remaining code. Subroutines are also called subprograms and as you can imagine, it is because they act as programs inside of a program. These subprograms are usually programmed so that they can be easily called multiple times within a program without re-writing the code over and over.

An example of a subroutine is a method that computes a logorithm or a matrix determinate. The method can accept 0 or more inputs and return 0 or 1 things.

These subroutines are often grouped into structures called libraries so that a large grouping of them can be easily accessed.

Demonstration

#include <stdio.h>
#include "library of subroutines"
int main()
{
    print "please enter a logarithm base"
    save input1
    print "please enter a second number for the logarithm"
    save input2
    answer = logarithmsubroutine(input1, input2)
    print "answer is 'answer'"
    return(0);
}

asm Objective

asm Objective

Experience using registers, stacks, and branches

Definition

Understand how registers, stacks and branches are made and used. Familiarity by experience using registers.

Method

So far we have been understanding them by reading up about them, asking questions, actually getting into building registers from flipflop. I believe the best way to understand all of these topics is to actually build them and understand their functionality.

Measurement

So far so good, we have started to build flipflop so that we can build registers. This has already helped me to start to grasp what a register really is and how one works. I have done a lot of reading on registers for opus keywords and will be asking a lot of questions in class tomorrow.

Analysis

Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.