Table of Contents

asm Keywords

asm Keyword 1

Logic Operations: And, Or, Not, and Xor

Definition

The logical operators take either one(Not) or multiple(And, Or, Xor) arguments and compare the argument(s) and create a new output depending on the specific operator.
And operator will check to see if all of the given arguments have the value that is being checked for, and will return true if they do and false otherwise.
Not operator will check the argument and give the opposite corresponding value.
Or operator will check to see if any one or more of the given arguments have the value that is being checked for, and will return true if so or else false.
Xor operator will check to see if exactly one of the given arguments has the value that is being checked for, and will return true if so or else false.
We are using bit-wise versions of these operators to check multiple registers and create a new one based on whether or not the corresponding bits in the given registers adhere to the logical operator that is being implemented. See code for example!  

Demonstration

given Register reg1: 00011011 and Register reg2: 00011000 use the And operator to produce reg3.

reg1: 00011011

reg2: 00011000


reg3: 00011000

asm Keyword 2

Instruction Sets

Definition

Scripts or programs in an architecture that allow for quick manipulation of key components in said architecture. In this project, our instruction sets are used to perform quick manipulations of key registers.

Demonstration

The following is an instruction for loading a given value into the accumulator:

#!/bin/bash
#
#A9-Immediate instruction
#loads given value into Accumulator
#
#../../datamanip Load calls the java program Load.java
#../reg/a.reg is the register the value will be loaded to
#./checkZero a calls the checkZero script with accumulator as the argument
#./checkSign a calls the checkSign script with accumulator as the argument
 
java -cp ../../datamanip Load $1 ../reg/a.reg
./checkZero a
./checkSign a

Command-line example:

lab46:~$ cd src/project/sim/ops
lab46:~/src/project/sim/ops$ ./0xA9 0

asm Keyword 3

Binary and Hexadecimal Number Representation

Definition

Representing numbers in base 2 (binary) and base 16 (hexadecimal) as opposed to decimal (10) which is normally used. It should be noted that for base 16: 10 == A, 11 == B, 12 == C, 13 == D, 14 == E, 15 == F

Demonstration

Demonstration will be through simple examples: It will be in the form (number)base → /*convert to*/ (number)base

(10)10 –> (1010)2 –> (A)16

(73)10 –> (1001001)2 –> (49)16

(115)10 –> (1110011)2 –> (73)16

(159)10 –> (10011111)2 –> (9F)16

(256)10 –> (100000000)2 –> (100)16

asm Keyword 4

Data Representation

Definition

The different ways to represent data. Such as base choice, (binary or decimal for example), and whether or not it is signed. For this project, we are using signed binary. For negative values we are using two's complement as opposed to one's.

Demonstration

Demonstration of the chosen keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Code snippets 
 * Take in a value
 * convert to binary
 */
 
import java.util.Scanner;
 
public class BinaryConverter
{
     public static char [] bin;
 
     public static void main (String [] args)
     {
          Scanner value = new Scanner (System.in);
          System.out.println("Input a value.");
          int val = value.nextInt();
          System.out.print(twoComp(val));
     }
 
     public static char [] oneComp (int val)
     {
         val = Math.abs(val);
         twoComp(val);
         for (int k = 0; k < bin.length(); k++)
             {
               if (bin[k] == '0')
                   bin[k] = '1';
               else 
                   bin[k] = '0';
             }
       return bin;
     }
 
     //convert to two's comp
     public static char [] twoComp (int val)
     {
        String binary;
        if (val >= 0)
            {
              binary = Integer.toBinaryString(val);
              for (int k = 0; k < binary.length(); k++)
                   bin[k] = binary.charAt(k);
            }
        else 
            {
              bin = oneComp(val);
              increment();
            }
        return bin;
     }
 
     //increment the array
     public static void increment()
     {
          boolean check = true;
 
          for (int k = 7; k >= 0; k--)
          {
             if (check == true)
             {
                if (bin[k] == '0')
                {
                     bin[k] = '1';
                     check = false;
                }
                else 
                {
                    bin[k] = '0';
                    check = true;
                }
             }
          }
     }
}

asm Keyword 5

von Neumann vs Harvard architecture

Definition

Harvard and von Neumann are two prominent computer architectures used in modern computers.

Explanation

The Harvard and von Neumann architectures are both very popular and both have a cpu based system. The primary difference between these architectures is that von Neumann stores data memory and data instructions in the same space, while the Harvard architecture stores data memory and data instructions in separate spaces. This has a couple consequences:

Both have advantages and disadvantages. For instance the Harvard architecture having separate spaces for instructions and data means that machines that run it need more physical space so as to keep them separate. However, this attribute is also advantageous in that simultaneous manipulation of instructions and data makes for a faster machine than can be achieved with a von Neumann architecture.

asm Keyword 6

Interrupts

Definition

Instructions or code that allow for quick changes in the instructions being executed.

Demonstration

An example of an Interrupt is the NOP (No Operation) instruction. The NOP instruction's only purpose is to increment the program counter.

# !/bin/bash
#
# INSTRUCTION:
#     0xEA - NOP instruction
#
# FUNCTION:
#     Increments the program counter.
#
# FLAGS FLIPPED:
#      None
#
 
PROGRAMCOUNTER="pc"      # The location of the program counter
 
java -cp ../../lib Increment ${PROGRAMCOUNTER}
 
exit 0

asm Keyword 7

Storage

Definition

Computers need to be able to recall previous instructions, and it is convenient for users to be able to frequently access media, or entertainment, or files that they want to put on the computer. To provide this function, computers are able to store information in memory. There are several different types of memory: ram, rom, and cache to name a few.

Demonstration

An example of using memory is saving a file that you are working on. E.G.- You are writing an essay for some reason, and you want to go to bed, so you save it so that you are able to shut off your computer and open it again at a later date.

asm Keyword 8

I/O

Definition

Input/Output refers to the process of interacting with a computing device by giving it parameters or instructions (input) and the machine executing the instructions and giving an answer or showing the result of the instructions (output).

Demonstration

My Demonstration will take the form of a simple program.

# Asks the user for his name and age,
# and prints out an interesting fact
 
prompt = '-->'
 
print "Hi, what is your name?"
name = raw_input(prompt)
 
print "Well, %s, is a nice name. How old are you?" % name
age = raw_input(prompt)
 
print """
So, your name is %s and you are %s years old.\nDid you know that Bears eat fish?\nWell they do.
""" % (name, age)
python nameandage.py
Hi, what is your name?
-->Tony
Well, Tony, is a nice name. How old are you?
-->20

So, your name is Tony and you are 20 years old.
Did you know that bears eat fish?
Well they do.