User Tools

Site Tools


opus:spring2012:bkenne11:part3

Part 3

Entries

Entry 9: April 19th, 2012: 3:50 PM EST

Todays learning expendentures invloved von neumann vs. harvard architecture comparisons. The part that stuck out to me the most was how similar they are while being so different. The von neumann architecture can either be reading an instruction or reading/writing data to/from the memory. They cant both happen at the same time because the instructions and data use the same system bus; whereas the harvard architecture, ceteris paris, just separates the reading to two separate system busses so that different types of processing can be done simultaneously.

Also, I did a little bit on binary vs. hex representation. Just a little spiel on base 16 vs. base 2 and base 10 for decimal. Also showed how to convert between binary, decimal and hex.

Bit Placementbit 8bit 7bit 6bit 5bit 4bit 3bit 2bit 1
Value128643216 8 4 2 1
DecimalHexadecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
10A1010
11B1011
12C1100
13D1101
14E1110
15F1111

Entry 10: April 21st, 2012

I/0, input/output, taking stuff in and pushing stuff out. The part that stuck out to me the most was how easy it was to relate input and output for a person to a computer. Computer input/output involves any peripheral devices such and a mouse, a keyboard, a printer, a monitor, etc… Just as a person has input like sight, sound, touch, smell, and taste.

Also, a cpu has input/output because the processing it does receives information, does something, and spits the information out. This relates to our cpu, our brain, receiving input and sending output. Kinda lame, but it was cool to see the similarities, and nothing else really stood out.

Entry 11: April 27th, 2012 5:04 EST

Been working on binary manipulation programs for a couple days now. Creating functions to increment(add one), decrement(subtract one), lshift(shift to the left one digit) rshift(shift to the right one digit) and a few others. The purpose of these manipulations is to implement them in use with registers. Once i finish them I will make a few registers(arrays filled with bits) and perform some manipulation on them with the functions I created in an attempt to simulate processor functionality. Tomorrow I will probably create load and store so that i can go from registers to memory(store) and memory to registers(load) so that i can get even further into the cpu simulation.

The way I have done my binary manipulations is a little different though, as it does not directly implement a carry. While the algorithm indirectly uses a carry in most of the functions, not all implement a carry in use, just in theory. So some of my functions, like increment, look a little different becasue there is no carry, like so:

void increment(char *array)
{
        int i;
        for(i=7;i>=0;i--)
        {
                if(array[i] == 0)
                {
                        array[i] = 1;
                        break;
                }
                else
                {
                        array[i] = 0;
                }
        }
}

Entry 12: May 1st, 2012

I think I will dedicate this dated entry to the people outside the MLC window screaming about how the government is trying to brainwash them while they pay way too much for college. I would write about something else, but I can't concentrate because they are TOO LOUD.

Todays work was all about boolean logic. I made a comparrison between true and false boolean and 1 vs. 0. I made two different programs to compare boolean values of true and false to 1 and 0. They set a boolean value to one and zero and then compared those values with boolean values of true and false. I know I am just saying the same thing over and over, but I don't really have anything else to say.

asm Keywords

von neumann vs. harvard architecture
Definition

A battle between computer architectures.

The harvard architecture has completely separate storage and signal pathways for instructions and data. This architecture stored all data within the CPU, and had no access to the instruction storage as data. All programs were loaded by a person. This means that the cpu can both read an instruction and perfom a data memory access at the same time, without a cache. The harvard architecture also has distinct data address spaces: instruction address zero is not the same as data address zero.

In contrast, the von neumann architecture can either be reading an instruction or reading/writing data to/from the memory. They cant both happen at the same time because the instructions and data use the same system bus.

The harvard architecture would be faster because instruction fetches and data access do not contend for a single memory pathway.

Binary and Hex number representation
Definition

The representation and conversions of/between hexadecimal, binary and decimal numbers.

Each digit in a binary number is called a bit, which form a byte when 8 bits are wrapped together. These bytes can take on the form of any combination of a “1” and a “0”, such as 10110010 or 00001001. This number system is called base 2, because is only has two different characters in its representation.

Below is a layout of the positioning of a binary byte.

Bit Placementbit 8bit 7bit 6bit 5bit 4bit 3bit 2bit 1
Value128643216 8 4 2 1

Therefore, with a binary number like 10011101, we get:

binary number10011101
ad up the place values of the ones12800168401

decimal equivalent is: 157

In hexadecimal, four bits is represented by a single digit. Since 4 bits gives 16 possible combinations, 0-9 are used along with A-F to represent the characters, meaning that hexadecimal must be base 16.

Below shows a relationship between hex, binary, and decimal.

DecimalHexadecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
10A1010
11B1011
12C1100
13D1101
14E1110
15F1111

For example, the number D93A is two bytes of data: 1101 1001 0011 1010. In decimal, 1101=13 + 1001=9 + 0011=3+ 1010=10 = 35.

Processor & Memory Organization
Definition

The major parts of a CPU are:

  • Registers
  • Flags
  • ALU
  • Buses
  • Control unit

The structure of these CPU's usually follows this scheme:

The Control unit acts as sort of a interfact to the outside via pins then buses. Then on the inside it communicates with the registers and the ALU, which can communicate with each other, or something like that.

Memory is organized into a two main different areas: On the CPU: Registers/RAM. Off the CPU: RAM, Harddrive, CD, Flash memory.

Control and Data Flow
Definition

Control flow literaly refers to controlling the flow of the program, or in what order the instructions of a program are executed in. A controlflow statement would have a condition that, based on the outcome of the condition, tells the program to do down one of two paths. In assembly, this control flow is based on a program counter. For most CPU's, the only control flow instruction available is a branch instruction.

if(day == monday)
{
    go get groceries;
}
else
{
    write down what groceries you need to get on monday;
}
Data Instructions

(Data Movement, Address Movement, Data Conversion, Bit Manipulation)

Definition
Data Movement

Data movement between registers and memory. This could be moving any peice of data from memory to a register in order to manipulate it, or loading an address from memory into registers so that it can be loaded.

Data Conversion

Converting between data encoding schemes such as Ascii, unicode and morse code. All of which are just a character pattern to represent a series of bits. This can be something as simple as a software upgrade from version 1.0 to 1.2.

Bit Manipulation

Bit mainpulation deals with manipulating a sting of binary bits. This includes functions like:

  • Increment
  • Decrement
  • Shift left or right
  • Roll left or right
  • AND, NOT, OR, XOR

Programming languages allow programmers to deal with high level representations of bit patterns and editing bit patterns via functions as described above like AND and left shift.

I/0
Definition

I/0 or Input/Output is something we do an uncountable amount of times a day. We are constantly sending and receiving message and signals that tell us how to interact and react to an enviroment. Similarly, it is how a computer communicates with another computer or a human. In other words it is how a computer sends/receives messages/signal/data.

Examples of input devices are mice and keyboards, which the computer receives input in the form of a mouse button press or a key press on the keyboard. An output device would be a printer, monitor or speakers, in which the computer outputs data in the form of sound or words for the user to read. An example of an input/output device is a disk drive or a flash drive. The computer can both read and write data to these devices. For a lower level implementation, the processor inputs/outputs device drivers that run these devices. The processor also provides memory-mapped I/O that is used the low level programming of these drivers.

Data Representation 1

Big Endian, Little Endian, Size, Integer, Floating Point, ASCII

Definition

Endian refers to end, and specifies which end of the number trail is the most significant bit. The twp types on endian are big and little, only differing in the position of the most significant big.

Big Endian

Big endian is where the most significant bit is on the left hand side and move to the right in order of decreasing significance. Therefore in 1010, the one all the way to the left would be the most significant and would represent 8, while the 0 all the way on the right would be the least significant and would represent 1.

Little Endian

Little endian is the reverse of big endian, and implements the common form of a “carry”. In little endian the most significant bit is on the right, while the least significant bit is on the left. Therefore in 1010, the one all the way to the left is now the least significant and represents 1, while the 0 on the right is the most significant and represents the 8.

Integer

An integer is a four byte data type that can be represented as a signed or unsigned range. A signed range allows for negative numbers, while an unsigned range allows for only non-negative numbers 0 or greater, within the size. This size can vary within computer architectures, but is most commonly four bytes.

INTEGER low high
Signed -2,147,483,648 2,147,483,647
Unsigned 0 4,294,967,295

There is four ways to represent a negative binary number, and the most common is two's compliment. For a deffinition of two's compliment look at the key word below labeled “data representation 2”.

Floating Point

Floating point descibes a way to represent real-numbers in a way that can show a wide range of values. These numbers are generally truncated to a fixed number of significant digits and then scaled by an exponent. Floating point means that the decimal point can float around the number, relative to the significant digits, and scaled to an exponent. The base for scaling is usually 2, 10, or 16.

Ascii

Ascii is a character encoding scheme used for information interchange. Ascii, based on the English language, represents text in computers, communications, and anything else that uses text. Ascii text, being an encomding scheme used for information interchange, represents series of bits. for example, the ascii character F is 01010111.

Data Representation 2

Sign Representation, One's Complement, Two's Complement

Signed Number Representation

signed number representation deals with encoding for negative numbers in the binary number system. In regular mathematics a negative number is prefixed by a - sign, showing that it is a negative number, but in binary there is no - sign. This is where sign representation methods come in to play.

One's Compliment

The one's compliment form of a negative binary number is a bitwise NOT applied to its positive couterpart. This system has two ways to represent zero: 00000000 which is a +0, and 11111111 which is a -0. As an example, the one's compliment of 00110100 (52) is 11001011 (-52). A byte thus ranges from -127 to +127 with a +-0.

binary valueone's complimentunsigned binary
00000000 0 0
00000001 1 1
00000010 2 2
00001010 10 10
01111101 125 125
01111110 126 126
01111111 127 127
10000000 -127 128
10000001 -126 129
10000010 -125 130
11110101 -10 245
11111101 -2 253
11111110 -1 254
11111111 -0 255
Two's Compliment

In two's compliment there is only one 0, 00000000. Negating a number is done by inverting all bits and then adding 1 to the resulting number. Therefore 01001110 (78) negated is 10110010 (-78) or 10110001 + 1.

binary valuetwo's complimentunsigned binary
00000000 0 0
00000001 1 1
00000010 2 2
00001010 10 10
01111101 125 125
01111110 126 126
01111111 127 127
10000000 -128 128
10000001 -127 129
10000010 -126 130
11110101 -10 245
11111110 -2 254
11111111 -1 255

asm Objective

asm Objective

Familiarity with the role of the C library.

Definition

Understanding the power of the vast resources of the C library. Familiarity with the types of functions in the many libraries, and familiarity with the man page function in order to understand what libraries are needed for what functions.

Method

Testing and improving my knowledge of what libraries are needed for the functions I have used and have knowledge of.

Measurement

I ran through some old programs and made sure I knew what libraries they were found in and I also looked up a listing of a lot of functions in the C library to try and broaden my understanding of what functions are available.

Analysis

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

  • How did you do? There isn't a real way to qauge this, but I did improve my understanding of the functions available through the C library.
  • Is there room for improvement? always is
  • Could the measurement process be enhanced to be more effective? always can be
  • Do you think this enhancement would be efficient to employ? always would be
  • Could the course objective be altered to be more applicable? How would you alter it? Give a more detailed explanation.

Experiments

Experiment 7

Question

Does the Boolean value true equal a 1 or 0 while false equals the other? Can a numeric comparison be made?

Resources

bytes.com → forumns.

Hypothesis

Based on my extensive research(all 5 minutes of it) I believe that the boolean value true can be expressed as an arithmetic 1, which false is 0.

Experiment

I will create a simple program that will add a boolean expression, such as (value == value1) to a number to see if the number increases.

Data

#include<stdio.h>
#include<stdbool.h>
int main()
{
        int i = 1;
        int value = 4;
        int value2 = 4;
        bool check = true;
 
        printf("Before: %d\n", i);
        i = i + (value == value2);
        printf("After: %d\n", i);
        if(check != i)
        {
                printf("David is a awesome");
        }
        else
        {
                printf("chickens are invading the bk lounge");
        }
        return 0;
}

Analysis

Based on the data collected:

  • Was your hypothesis correct? Yes, it was right on target
  • Was your hypothesis not applicable? no
  • Is there more going on than you originally thought? (shortcomings in hypothesis) none that i can see
  • What shortcomings might there be in your experiment? none that i can see
  • What shortcomings might there be in your data? none that i can see

Conclusions

What can you ascertain based on the experiment performed and data collected?

Boolean logic(true or false) can be related to 1 vs. 0. The value true is equal to the value one, while false is equal to 0.

Experiment 8

Question

Can you set a bool equal to 1 and have it represent true? If not what happens?

Hypothesis

Based on the forumns i have read, and past experiments I have done, I believe there is a good chance of it working.

Experiment

Ima write some code that sets a bool equal to 1, and see if it executes as true.

Data

#include<stdio.h>
#include<stdbool.h>
int main()
{
        bool value = false;
        bool check = true;
        value = 1;
        if(value == check)
        {
                printf("Theya re too loud");
        }
        else
        {
                printf("i hate this");
        }
        return 0;
}

Analysis

Based on the data collected:

  • Was your hypothesis correct? yes, yes it was
  • Was your hypothesis not applicable? nope
  • Is there more going on than you originally thought? (shortcomings in hypothesis) not that i see
  • What shortcomings might there be in your experiment? if i knew, they wouldent be in there
  • What shortcomings might there be in your data? if i knew, they wouldent be there

Conclusions

What can you ascertain based on the experiment performed and data collected?

We knew that in the background boolean was just 1 and 0, we just didn't see it anymore because they are set to true or false. Now I can see that nothing really changed, and that boolean is still 1 or 0, they are just equivalent to true or false.

Retest 3

Perform the following steps:

State Experiment

David Schoeffler My final experiment will be whether you can declare an auto variable without initializing it and if so how will it respond. http://www/opus/spring2012/dschoeff/start

Resources

Evaluate their resources and commentary. Answer the following questions:

  • Do you feel the given resources are adequate in providing sufficient background information? yes, he provided a source pdf covering the implementation of the autotyped variable.
  • Are there additional resources you've found that you can add to the resources list? they are all redundant of the information in the pdf
  • Does the original experimenter appear to have obtained a necessary fundamental understanding of the concepts leading up to their stated experiment?adequate
  • If you find a deviation in opinion, state why you think this might exist. none

Hypothesis

State their experiment's hypothesis. Answer the following questions: I do not believe you will not be able to declare the auto typed variable without initializing it.

  • Do you feel their hypothesis is adequate in capturing the essence of what they're trying to discover? yes
  • What improvements could you make to their hypothesis, if any? none

Experiment

Follow the steps given to recreate the original experiment. Answer the following questions:

  • Are the instructions correct in successfully achieving the results? yes
  • Is there room for improvement in the experiment instructions/description? What suggestions would you make? none that i see without being rediculous
  • Would you make any alterations to the structure of the experiment to yield better results? What, and why? none

Data

Publish the data you have gained from your performing of the experiment here. I used the original experimentee's materials, so i received the same results from the same code: <code c> 1: #include<iostream> 2: 3: using namespace std; 4: 5: int main() 6: { 7: auto autovar; 8: cout « “enter value to put in auto typed variable: ” ; 9: cin » autovar; 10: cout « “value stored in auto typed variable - > ” « autovar « endl; 11: 12: return (0); 13: } <code>

lab46:~$ g++ --std=c++0x autotest.cc -o autotest
autotest.cc: In function 'int main()':
autotest.cc:7: error: declaration of 'auto autovar' has no initializer
lab46:~$

Analysis

Answer the following:

  • Does the data seem in-line with the published data from the original author? yes
  • Can you explain any deviations? none
  • How about any sources of error? none
  • Is the stated hypothesis adequate? entirely

Conclusions

Answer the following:

  • What conclusions can you make based on performing the experiment? The auto typed variable cannot be used without first being initialized
  • Do you feel the experiment was adequate in obtaining a further understanding of a concept? yes
  • Does the original author appear to have gotten some value out of performing the experiment? yes
  • Any suggestions or observations that could improve this particular process (in general, or specifically you, or specifically for the original author). none
opus/spring2012/bkenne11/part3.txt · Last modified: 2012/05/02 16:54 by bkenne11