Brandon Kennedy's Spring 2012 Opus
Welcome to the fun!
This is a story all about how I got turned into a programming hound And I'd like to take a minute and sit right there And tell you how i became the prince of the BDC Lair
In west horseheads i was born and raised On the computer was where I spent most of my days gettin high scores and chomp'n up coins commander keen was my, closest boy
When a couple of guys who were upto no good startin' makin' trouble in my neighborhood I got in one LARP fight and my mom got scared she said you're gonna go to college they can, help you there.
I whistled for my teacher and when he came near his shirt said nerd and he beard said weird If anything i could say this lad is rare but i though nah forget now on the the Lair
I walked into the Lair about 7 or 8 And i yelled to a guy yo homes where I sit he looked at me weird like his mind was, kinda flat I later learned his name was, brian black
I am pretty sure that this is going to be the ONLY class I enjoy this semester. Physics is so nit-picky it is driving me crazy and the first week isn't even over! Then there is biology… If you put my first weeks bio notes in a book it would be the size of the websters exhaustive concordance.
Let's just get this project moving, I can't wait to learn the very basics, the fundamental parts of the foundation if you will.
Today was an epic day to say the least. Today we ventured into the crazy land of flipflops which pretty much flipfloped my mind. Since I was the one to bring up starting flipflops I got to code the first flip flop and I tell you what, it was insane! Not that the code was anything durastic. It wasn't 500 lines long, and it didn't use a bunch of strange libraries that noone had ever heard of before, it was that the logic didn't make sence. Beow is an example of a NAND flipflop:
include "nandff.h" NANDFF::NANDFF() //NANDFF constructor { mynandgate = new NAND(); //instantiation of a NAND gate mynandgate2 = new NAND(); //second NAND gate mynotgate = new NOT(); //Not gate } bool NANDFF::Q() //here is where the magic begins! { mynandgate -> setA(A); mynandgate -> setB(mynandgate2 -> getX()); mynandgate2 -> setA(mynandgate -> getX()); mynandgate2 -> setB(B); return(mynandgate -> getX()); } //bool Q is the output of the NANDFF that is not negated. bool NANDFF::NQ() { mynandgate -> setA(A); mynandgate -> setB(mynandgate2 -> getX()); mynandgate2 -> setA(mynandgate -> getX()); mynandgate2 -> setB(B); mynotgate -> setA(mynandgate -> getX()); return(mynotgate -> getX()); } //likewise NQ is the negated output of NANDFF.
Does this make any sence to you? It makes sence to me, I just don't totally get it!
It is amazing how an internet meem can help you understand a computer science topic. We used long cat(turned into long worm) to describe the concept of an infinite tape. And when you understand the joke about long cat being reeeeeally long, or pretty much infinate in our understanding, it make so much sence! Anyways, we have been working from the top down lately trying to make sence of the menu that will be displayed. This is really helpful because we start to realize what functions we need and at what level they need to be developed, so we can develop our base logic into the bigger parts. An example of this is finding out what type of registers we will need, and how many, and then using our base logic to build those types of registers. our menu looks like this:
while ((input != 8)&&(snap != 'y')) { printf("Computer Simulator Menu, yo\n\n"); printf("1) Enter Program\n"); printf("2) Run Program\n"); printf("3) Single Step Program\n"); printf("4) Load from File\n"); printf("5) Save to File\n"); printf("6) Memory Dump\n"); printf("7) Register Display\n"); printf("8) Exit\n"); printf("Please enter your choice: "); cin << input: switch (input) { case 1: printf("Enter memory address to start at: "); cin << hexnum; // break; case 2: printf("Enter hex address to run at: "); cin << hexnum; // break; case 3: printf("Enter hex address to run at: "); cin << hexnum; // break; case 4: printf("Enter file name to load program from: "); cin << filename; // break; case 5: printf("Enter file name to save to: "); cin << filename; printf("Enter program starting address to save to file '%s'", &filename); cin << hexnum; // break; case 6: //print out a listing of hex addresses used in current programs //dump all da crap break; case 7: //print out the contents of all the registers and the hex address for the cpu break; case 8: break; default: printf("Invalid option"); //reprint menu }
Over the last week we have been covering our menu, a bit on registers, and the turing machine. First off is our menu, which i posted a copy of in my last entry. It hasen't developed very much, but i plan top develop it more tomorrow(wednesday), so that we can create logic to print out register addresses and contents, dump memory and exit out of the menu loop when 8 is pressed. Maybe even develop the inner menues of each case a little bit more. Now on to turing, the unstable autistic! Genious or madman? or both? Turings special case of autism led him into a whole new world of intelligence. He could imagine and remember whole elements of a “computer system” in his head. He created to touring machine out of pure imagination fabrication, meaning it was all in his head. This touring machine ran by a not so complex, but exhaustive set of symbols that I still don't really understand. The logic is a bit beyond my comprehension without writing it down, I can't do it all in my head :p
Registers (General Purpose/Integer, Floating Pointer, Accumulator, Data)
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.
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.
Registers (Stack Pointer, Program Counter, Flag/Status)
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.
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.
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.
Z | Zero Flag | Indicates that the result of an arithmetic or logical operation (or, sometimes, a load) was zero. | |||
C | Carry Flag | Enables 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/N | Sign 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/W | Overflow flag | Indicates that the signed result of an operation is too large to fit in the register width using twos complement representation. | |||
P | Parity flag | Indicates whether the number of set bits of the last result is odd or even. |
Registers (Index/Pointer)
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.
AND, OR, XOR
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.
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.
A | B | output | |||
1 | 1 | 1 | |||
1 | 0 | 0 | |||
0 | 1 | 0 | |||
0 | 0 | 0 |
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.
A | B | output | |||
1 | 1 | 1 | |||
1 | 0 | 1 | |||
0 | 1 | 1 | |||
0 | 0 | 0 |
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.
A | B | output | |||
1 | 1 | 0 | |||
1 | 0 | 1 | |||
0 | 1 | 1 | |||
0 | 0 |
NOT, NAND, NOR, XNOR
A negated operation. The output of this operation is the opposite of its non-negated couterpart. Look at keyword 4 :p
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.
A | output |
1 | 0 |
0 | 1 |
A NAND operation, as well as NOR and XNOR build on the the not operation.
NAND | ||
A | B | output |
1 | 1 | 0 |
1 | 0 | 1 |
0 | 1 | 1 |
0 | 0 | 1 |
NOR | ||
A | B | output |
1 | 1 | 0 |
1 | 0 | 0 |
0 | 1 | 0 |
0 | 0 | 1 |
XNOR | ||
A | B | output |
1 | 1 | 1 |
1 | 0 | 0 |
0 | 1 | 0 |
0 | 0 | 1 |
Boolean Arithmetic Operations (Addition, Subtraction, Multiplication, Division)
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.
Instruction Sets (CISC, RISC)
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 of the chosen keyword.
Instruction: store A +B in A. Operations involved:
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.
Subroutines (Calling, Return Address)
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.
#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); }
Experience using registers, stacks, and branches
Understand how registers, stacks and branches are made and used. Familiarity by experience using registers.
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.
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.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
Does the Nvidia 9800 from the church video PC still function after it crashed? can the drivers be re-done or it it toast?
http://www.official-drivers.com/installer seeded with nvidia
I think that the card will be toast, and that the computer will not boot properly when the card is installed, and that it is beyond help.
There were two video cards running simultaneously in the computer when one of them failed. It took took the operating system with it.
stupidly, I am going to stick it in a computer tower that I have and see if:
The computer not only booted up, but the graphics card displays fine!
Based on the data collected:
Based on the data collected by this experiment, i can ascertain that the video card is totaly fried, but I still want to try it in another computer, or dual booting to see if the other card will run so i can do diagnostics on the first card.
What is causing the security camera computer to shut down and restart randomly? what caused the cmos to change by 4 minutes and lose the boot sequence it had?
Based on my research I believe the the cmos lost the boot sequence because the cmos battery is shot, and there is a cmos capacitor that is malfunctioning.
Pull open the case and check the cmos battery. If it is shot, then check the capacitor.
Cmos battery is shot, can't find the capacitor that should be on the board. I'll have to do more extensive research to find out why the computer is shutting down, but i think it is related to the cmos and bios issues.
Based on the data collected:
I can conclude that there is most likely a cmos issue because of a dead cmos battery, and that the loss in cmos might have affected the boot sequence to chance, possibly affecting the bios aswell.
Can HDMI be directly converted to DVI through an adapter, or do you need more intelligence inbetween?
googling hdmi to dvi adapters
It only takes an adapter, nothing special.
I'm going to buy an adapter and see what happens!
Well would you look at that! It only takes an adapter.
Based on the data collected:
I can ascertain that matt haas must have been thinking of something else, and that it only takes an adapter to convert hdmi to dvi.
Today was a fun-filled talk about instruction sets. We are in the process of creating an instruction set forour 6502 wannabe.
Each instruction is allocated 4 bytes of memory, and are laid out as follows.
instruction | first byte | second byte | third byte | fourth byte |
and | 000.00.00.x | 00.xxxxxx | xxxxxxxx | xxxxxxxx |
or | 001.00.00.x | 00.xxxxxx | xxxxxxxx | xxxxxxxx |
not | 010.00.xxx | 00.xxxxxx | xxxxxxxx | xxxxxxxx |
if/branch | 011.00.xxx | xxxxxxxx | branch address | branch address |
move | 100.xx.xx.x | xxxxxxxx | xxxxxxxx | xxxxxxxx |
These are not yet fully developed, as you can see by move and others, but they are great progress!.
I also started to develop my schedule for next semester. It looks like I will be taken hpc1, hardware 101, electricity 101, and another computer course that yet again has slipped my mind! that should be 13 credits, so financial aid? i think so!
This weeks experiences haven't been fun filled, but I have certainly learned a lot. Maybe it is time for a little recap:
Storage: Volatile vs. Non-volatile.
Volatile memory refers to short term memory, such that is only kept when there is power to the memory. An example of this type of memory is RAM, which is used to store information temporarily while the computer is running. An example of this RAM is CPU RAM, which is used as quick access storage for the CPU.
Non-Volatile memory refers to long term memory, such that is kept whether there is power to the computer or not. An example of this type of memory is your hard drive, where most of your computers information is stored.
Understanding the difference between these two helps to shed light on what RAM is used for. Since the RAM is cleared every time the computer is powered off, it must hold information that is created when the computer is started, or when a program is started, but does not affect the programs start-up. In other words it does not contain any of the instructions for the computer of it's programs, just the information they create that is pertinent to it's current running state.
This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.
As an aid, feel free to use the following questions to help you generate content for your entries:
Remember that 4 is just the minimum number of entries. Feel free to have more.
This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.
As an aid, feel free to use the following questions to help you generate content for your entries:
Remember that 4 is just the minimum number of entries. Feel free to have more.
An internal element that transfers data between computer components, or between computers.
A bus is a way to connect a peripheral device for data transfer. They have evolved from a different card for every peripheral to universal busses to connect many different peripherals through the same bus. These busses can range from a system bus, to attach a cpu, to a universal serial bus to connect anything from a mouse or keyboard to another harddrive.
Few more examples:
An address bus is a computer bus that is used to specify a physical address. When a processor needs to read or write to a memory location it specifies that memory location on the address bus.
Early processors used to you a single wire for each address bit that it sent, meaning a 32 bit address bus used a 32 wire connector. This was soon replaced by cutting the address in half and sending it in two waves, cutting a 32 bit address bus down to a 16 wire strip.
The width of the address bus determines the amount of memory a system can address.
An asynchronous signal that indicates the need to look at a certain event or tell running software to change its execution.
Hardware Interupt:
Software interupt:
Stax yo! a stack is a last in, first out data gobbling beast! Also called a LIFO if you must. These work like a stack of papers. The last page you set on the stack is the top page, and you cannot access any of the pages below without first moving/removing the pages above it. They are commonly implemented using a linked list, but can also be implemented by use of an array.
There are three common stack operations, and they are as follows:
#include"stack.h" Stack *push(Stack *notes, int val) { Node *stick; stick=(Node *)malloc(sizeof(Node)); stick -> value = val; if(notes -> top == NULL) { notes -> top = notes -> bottom = stick; } else { notes -> top -> prev = stick; stick -> next = notes -> top; notes -> top = notes -> top -> prev; } return notes; }
It's a bunch o' bits wrapped up all nice and neat for a computer to read, like an instruction of sorts. The number of bits in a word(size, width, length) is defined by the proccessor design, or the computer architecture. The size of a word reflects the computers operation. Registers are often word sized, and the largest peice of memory that can be moved into working memory is the size of word. Common sizes today are 32 and 64 bit.
Depending on how the computer is structured, units of the word size can be:
Puttin stuff in spots to keep it for a while. The retension of information.
short term
long-term
A portion of code running inside a program that has one specific purpose and is relatively independant of the rest of the code to be performed.
A subroutine is also called a subprogram, and as that insinuates, it will act much like a program itself, running inside a larger program. A subroutine is usually code that can be called multiple times from multiple places inside the program.
Subroutines are often collected into libraries, and contain programs such as mathmatical computations.
The fetch-execute cycle is the basic operation cycle of a computer. This cycle is repeated by the CPU from startup to when the computer is shut down and is the process by which the computer retreives its instructions from memory.
The cicuits used in a fetch-execute cycle are:
So, to break it down:
familiarity with how assembly impacts programming.
How assembly will impact the styles and flow of programming. How the code is put together in functions.
General discussion on how assembly affects programming. Matt has expressed that assembly and processor commands can affect programming styles by helping to make code more efficient.
The only good way to measure this is to review some code that I recently wrote to see if i can relate my new knowledge of assembly and processor instructions to coding styles.
I can see how processor commands can affect programming styles. I can not yet really optimize any code or change the flow based on what the processor does/receives, but I believe that by the end of this course I will be able to optimize my code at least a little by being processor sensitive.
There is deffinitely room for improvement, I think I need to do some research on assembly commands so that I can better understand what the processor is being told because of the code I am writing.
How can an ethernet cable provide power to an end device?
Power over ethernet is done by sending a dc current over four of the wires.
I will research PoE and find an example of how PoE sends a dc current over the same line that data is sent over. Also, there is a PoE phone in the lair, so i will mess around with that to see it in action.
I hooked an IP phone up to a PoE supplier that adds a dc current to the ethernet cable. I also plugged an active ethernet cable into the PoE supplier so that it was supplying a dc current and an internet signal over the same line.
Wikipedia displays a great table that shows the pins used in a PoE setup for both 10/100 and gigabyte PoE connections.
Based on the data collected:
PoE is a very powerful tool that can be very useful when there are a lot of IP phones or wireless access points that need to periodically be reset. All one has to do is simply reboot the source of the ethernet cables and all end devices will be reset.
If I am connected to a gigabyte switch that has a dedicated line from roadrunner, will the download/upload of my computer by a gigabyte?
I can only reach speeds of 100mbps or whatever the incomming line allows me to reach.
I will hook my laptop up to a gigabyte router and do speed testing like speedtest.net, command prompt things to check speed rates, and network and sharing center.
Speedtest.net claims 96mbps, 100mbps and 92mbps. network and sharing center claims anywhere from 56-400 mbps depending on what i'm downloading. command prompt, essentially doing the same thing speedtest.net, claims about 92-98mbps.
Based on the data collected:
Your connection speed is based on your hardware/connection. If everything allows 1000mbps, then you could essentially get 1000mbps. If you have a 1000mbps connection, and only a 100mbps port, then you will only get 100mbps.
Perform the following steps:
David Schoefflers experiment on autp typed variables. http://lab46.corning-cc.edu/opus/spring2012/dschoeff/start#experiment_2
Evaluate their resources and commentary. Answer the following questions:
State their experiment's hypothesis. Answer the following questions:
Follow the steps given to recreate the original experiment. Answer the following questions:
Publish the data you have gained from your performing of the experiment here.
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: }
I ran the same code and received the same errors in compiling
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:~$
Answer the following:
Answer the following:
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 Placement | bit 8 | bit 7 | bit 6 | bit 5 | bit 4 | bit 3 | bit 2 | bit 1 |
Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Decimal | Hexadecimal | Binary |
0 | 0 | 0000 |
1 | 1 | 0001 |
2 | 2 | 0010 |
3 | 3 | 0011 |
4 | 4 | 0100 |
5 | 5 | 0101 |
6 | 6 | 0110 |
7 | 7 | 0111 |
8 | 8 | 1000 |
9 | 9 | 1001 |
10 | A | 1010 |
11 | B | 1011 |
12 | C | 1100 |
13 | D | 1101 |
14 | E | 1110 |
15 | F | 1111 |
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.
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; } } }
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.
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.
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 Placement | bit 8 | bit 7 | bit 6 | bit 5 | bit 4 | bit 3 | bit 2 | bit 1 |
Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Therefore, with a binary number like 10011101, we get:
binary number | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |
ad up the place values of the ones | 128 | 0 | 0 | 16 | 8 | 4 | 0 | 1 |
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.
Decimal | Hexadecimal | Binary |
0 | 0 | 0000 |
1 | 1 | 0001 |
2 | 2 | 0010 |
3 | 3 | 0011 |
4 | 4 | 0100 |
5 | 5 | 0101 |
6 | 6 | 0110 |
7 | 7 | 0111 |
8 | 8 | 1000 |
9 | 9 | 1001 |
10 | A | 1010 |
11 | B | 1011 |
12 | C | 1100 |
13 | D | 1101 |
14 | E | 1110 |
15 | F | 1111 |
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.
The major parts of a CPU are:
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 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 Movement, Address Movement, Data Conversion, Bit Manipulation)
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.
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 mainpulation deals with manipulating a sting of binary bits. This includes functions like:
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 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.
Big Endian, Little Endian, Size, Integer, Floating Point, ASCII
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 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 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.
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 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 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.
Sign Representation, One's Complement, Two's Complement
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.
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 value | one's compliment | unsigned 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 |
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 value | two's compliment | unsigned 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 |
Familiarity with the role of the C library.
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.
Testing and improving my knowledge of what libraries are needed for the functions I have used and have knowledge of.
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.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
Does the Boolean value true equal a 1 or 0 while false equals the other? Can a numeric comparison be made?
bytes.com → forumns.
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.
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.
#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; }
Based on the data collected:
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.
Can you set a bool equal to 1 and have it represent true? If not what happens?
Based on the forumns i have read, and past experiments I have done, I believe there is a good chance of it working.
Ima write some code that sets a bool equal to 1, and see if it executes as true.
#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; }
Based on the data collected:
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.
Perform the following steps:
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
Evaluate their resources and commentary. Answer the following questions:
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.
Follow the steps given to recreate the original experiment. Answer the following questions:
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:~$
Answer the following:
Answer the following: