Monday, August 20, 2012

Filling up the Screen and erasing it


Next project is to get the screen to fill black with a key press. This should be a little easier. This project wasn’t easier but it also wasn’t harder. After getting the screen to fill with key press and erase with the key up I had a problem checking for memory boundaries. As I was trying to figure it out I decided to post on the forums and ask for help. This is what I typed out

I made the Fill.asm program and it will fill the screen to the bottom with black and if the key is let go it will erase all the black. The Issue is that it will keep going passed the screen memory and on erase it will go all the way passed the memory in the other direction.

[begin]
How can I check for memory boundary?

I tried
(FILL)
@Store
D=M
A=D
//here I need to check if the address is too big if so then just jump back up
@24575
D=D-A
@KEYDWN
D;JEQ

But it just goes way out of bounds.
[End]

After typing this and before submitting I reread 4.2 example and realized I was  changing D and that I could read memory as much as I want as long as I don’t wright to it. So I did this.

@Store
D=M
@24575
D=D-A
@KEYDWN
D;JEQ
That way I was reading the memory and checking if it was out of bounds at the bottom

@Store
D=M
@SCREEN
D=D-A
@KEYDWN
D;JEQ

And out of bounds at the top.

So after a very long delay I finished chapter 4 still needing to do more examples because I still don’t fully understand ASM because using only 3 calls one has to make things so much simpler and the order of every last command is important.
            It is now my belief that all computer science students should take a very basic ASM class after taking BASIC or PASCAL but before taking C/C++ class’s. It helps with so many different things.

Multiplying by adding


 When running the test script I was clearing all the locations but the test script would put in the data first before I cleared then all the results would be wrong. I just had to make the result 0 every go around but since the other two memory locations were going to be over written any way I just left them alone.
            After doing this project I realized that if one plans out there project and Knows that the variable is going to be 0ver written then one does not need to clear it each time but always zero out variables that are not going to be over written but just read then written to.
The key to the multiply project is to know that when your multiplying you are adding itself to itself as many times as the multiplier says to. Also using a loops and jump statements are good.

Here was my laid out plan

//Start at fisrt memory location
//then stick that in to be computed
//then add it to itself as many times as it is supose to be multiplyed by
//use the multiplyer to controll the loop or counter

Part of the code that add'ed the data

@R1 
D=M
@R2
M=D+M
@LOOP
0;JMP


After a very long break. Getting under way....


            On and off for five months of trying to figure out the Hack assembly language and re reading  chapter 4 five or six time on top of taking pages and pages of notes I learned how to use it. Assembly language is different than any other language I have learned. Calling the memory location then putting data into that location.
Here is what I played with to figure out the ASM


@1    //this is the address to the memory where the program starts at
      //And since the system just started that memory location should be blank or 0
D=M   // since the above address memory location is empty then D is the value of the memory
@5    //this is a new value
D=D-A //A is = to 5 and D is equal to 0 so the new Value of D is -5
@100  //the vaule in the A register is now 100
D;JEQ // D = -5 JEQ is Jump to 100 in the program if D is equal to 0
@7 //A is now 200 if 7 then program doesnt move at all
M;JMP // Just jump to 200 in the program if 0 but if M Jump to 200 in memory also


Something like this should have put in the book with that much info on what the coded did.

Thursday, March 29, 2012

Progress on creating all the hardware

I am making all the schematics and taking pics of all the hardware. I am also videoing all the progress.
Next thing I will be doing is simulating all the schematics before I build the more complex parts.

Just trying to get my blog out there

{EAV:a0afc2bea14f8c11}

So I want to draw as many people to my blog as I can. Why you may ask? I want to be able to get comments that will help me better understand the people who would want to buy a DIY computer and help educate people the easy and fun way

Thursday, March 22, 2012

The memory map


Activity 34

Creating the memory map was a little confusing because the output switching but after a little trial and error and studying the memory map in the book and arranging the chips in the order of the book I got them all to work. Now I need to figure out how to make my own keyboard and video on my own and implement them. I do have a book on creating my own video game console so I am going to combined that with what I have and it should lead me in the right direction.   

Tuesday, March 20, 2012

Update on the 4bit ripple comparator

After looking at more info on the comparator I decided to create a 1bit comparator in Logisim. (http://ozark.hendrix.edu/~burch/logisim/)
It came out great because then I found the equation for the comparator and used it to make the 1bit into a 4bit ripple comparator. Here is how it is.

The inputs are always true or on tell it is attached to another one. I am not 100% that this is the best way to do it. Let me know if there is a batter way

Monday, March 19, 2012

Logic design software


A few logic design software's. 

WinLogiLab


http://www.griffith.edu.au/professional-page/charles-hacker/resources/winlogilab

The logic lab
http://www.neuroproductions.be/logic-lab/

Simple solver
http://home.roadrunner.com/~ssolver/syn.html

Logisim
http://ozark.hendrix.edu/~burch/logisim/

I am going to try a few out and see which one works best for me and see if it cant speed up creating some of these more elaborate logic deign

Here is a list of more but not all of them are free.

http://www.electronicsoft.net/en-us/dept_3.html

Set less than or SLT

To be more MIPS compatible I need the function STL. After a lot of research and some help from cadet1620 I found from a book that I had called "Fundamentals of Logic Design 4th edition by Charles H. Roth, Jr." that STL is part of a set called a Comparator. Also I found it on this web site http://www.electronics-tutorials.ws/combination/comb_8.html. The logic set does not match exactly between the two so I am going to have to figure out exactly how it works so I can add it to my ALU. Also I might have to add my functions to the CPU emulator to incorporate my additions.  More to come as I figure it out more clearly.

After looking closer I found that it is called Digital magnitude comparators. The IC that goes with it is a TTL 7 485. The logic diagram helped me understand what was need to cascade 4bit comparators.  I found the info here http://www.dauniv.ac.in/downloads/Digitalsystems_PPTs/DigDesignCh12L1.pdf

Sunday, March 18, 2012

Using the software

i went though the Assembler simulator and the CPU simulator and they worked like expect. I tried out all the samples and they worked great. Note I really like how the assembler simulator translate the assembly to binary now there should be one for windows it would be really cool to see the binary code that runs a basic exe file.

Update to my 16bit Adder

So with a few additions to my 4bit adder with look ahead carry I believe I can now detect over flow situations. I have not tested it 100% but I did do a few test and it worked every time

Check it..
 OUT out[4],carry,OvF; //added OvF as an out pin

then added
Or(a=cout12,b=cout13,out=c1,out=carry);
Xor(a=out42,b=c1,out=OvF); for the over flow detection

Now just to add it to my ALU

8bit adder

Add4(a=a[0..3],b=b[0..3],c=c,out=out[0..3],carry=carry1,OvF=OvF1);//ignore overflow in first set
Add4(a=a[4..7],b=b[4..7],c=carry1,out=out[4..7],carry=carry,OvF=OvF);

16bit adder

Add8(a=a[0..7],b=b[0..7],c=false,out=out[0..7],carry=carry1,OvF=OvF1);//ignore overflow here
Add8(a=a[8..15],b=b[8..15],c=carry1,out=out[8..15],carry=carry,OvF=OvF);//out put here


First step to optimize ALU

I found a good schematic for look ahead carry adder 4 bit and added it to my 4bit adder. But before I did that I was thinking why would adding more gates make it go any faster then I thought the adding part the less gates it acutely goes through the faster and since the carry is just essentially copying the input and working on it in parallel of the actually addition I can see how it could be a lot faster. With no further ado here is the code I got from the schematic.

[code]

CHIP Add4 {
    IN a[4], b[4],c;
    OUT out[4],carry;

    PARTS:
This is my first 4bit adder
/* HalfAdder(a=a[0],b=b[0], sum=out[0], carry=c1);
FullAdder(a=c1,b=a[1],c=b[1],sum=out[1],carry=outa3);
FullAdder(a=outa3,b=a[2],c=b[2],sum=out[2],carry=outa4);
FullAdder(a=outa4,b=a[3],c=b[3],sum=out[3],carry=outa5);*/

//A0 B0
And(a=a[0],b=b[0],out=out1);
Or(a=a[0],b=b[0],out=out2);

And(a=out2,b=c,out=out3);//needs an input
Or(a=out1,b=out3,out=out4);

Not(in=out2,out=out5);

Or(a=out5,b=out1,out=out6);

Xor(a=out6,b=c,out=out7);//needs an input
Not(in=out7,out=out[0]);

//A1 B1
And(a=a[1],b=b[1],out=out11);
Or(a=a[1],b=b[1],out=out21);

And(a=out21,b=out4,out=out31);//needs an input
Or(a=out31,b=out11,out=out41);

Not(in=out21,out=out51);

Or(a=out51,b=out11,out=out61);

Xor(a=out61,b=out4,out=out71);//needs an input
Not(in=out71,out=out[1]);

//A2 B2
And(a=a[2],b=b[2],out=out12);
Or(a=a[2],b=b[2],out=out22);

And(a=out22,b=out41,out=out32);//needs an input
Or(a=out32,b=out12,out=out42);

Not(in=out22,out=out52);

Or(a=out52,b=out12,out=out62);

Xor(a=out62,b=out41,out=out72);//needs an input
Not(in=out72,out=out[2]);

//A3 B3
And(a=a[3],b=b[3],out=out13);
Or(a=a[3],b=b[3],out=out23);

//And(a=out2,b=,out=out3);//needs an input
//Or(a=out3,b=b[0],out=out4);

Not(in=out23,out=out53);

Or(a=out53,b=out13,out=out63);

Xor(a=out63,b=out42,out=out73);//needs an input
Not(in=out73,out=out[3]);

//C1
//4 way and
And(a=out1,b=out21,out=cout1);
And(a=cout1,b=out22,out=cout2);
And(a=cout2,b=out23,out=cout3);//out
//3 way and
And(a=out11,b=out22,out=cout4);
And(a=cout4,b=out23,out=cout5);//out
//
And(a=out12,b=out23,out=cout6);//out
//4 way and
And(a=out2,b=out21,out=cout7);
And(a=cout7,b=out22,out=cout8);
And(a=cout8,b=out23,out=cout9);//out


//4 way or
Or(a=cout3,b=cout5,out=cout10);
Or(a=cout10,b=cout6,out=cout11);
Or(a=cout11,b=cout13,out=cout12);//out

And(a=cout9,b=c,out=cout13);

Or(a=cout12,b=cout13,out=carry);

}
[/code]
If any one knows how I can break this up into basic adder and faster carry sections let me know. I haven't annualized the code that close to see what would need to be done.
The more help I get the faster I can get all of this done and have a open source system that any one could build.

Saturday, March 17, 2012

Update


Update 4
Creation of all Logic gates with NAND IC 4011 CMOS
Gate types
Done
AND
X
OR
X
NOR
X
NAnd
X
NOT
X
XOR

XNOR

They are all done now moving on to composite gates

Update on the Switch to CPU Kits


Update 3
Creation of all Logic gates with transistors
Gate types
Done
AND
X
OR
X
NOR
X
NAnd
X
NOT
X
XOR

XNOR

Again the exclusive gates seem to have more components then any others. I will try them after I complete the IC gates.

Friday, March 16, 2012

A further update on Switches to cpu's


Update on step one create all basic logic gates with switches
So far I have made
Gate types
Done
AND
X
OR
X
NOR
X
NAnd
X
NOT
X
XOR

XNOR

Unable to make the Exclusive gates right now. It would take a lot of pushbutton switches and lots of fingers. I believe I could make the XOR gate with a dtsp slide switch which I do not have at this moment
I am now going to recreate these gates with transistors.

From Switches to CPU (playlist)

('http://www.youtube.com/p/28A81D76E3FD63FB?version=3&hl=en_US',)

this is the video series that is going to go with it.

Update one on the up coming kits


Step one crate all basic logic gates with switches.
And [X]
OR[X]
NOR[X]
NAND[ ]
I have some short videos and pics showing that the gates marked are working will upload soon.
I have all the parts to make a few kits. Hit me up if you want to donate to the project and get one.

Thursday, March 15, 2012

65% done with the class next stop ALU optimization


All done with chapter’s one through three. Most of the hardware is all done. The next chapter is on creating an assembler language. After completing this one I am going to go back and fix up the ALU to make sure it will be compatible with the MIPS architecture which then will be able to run some real world software and it will also be a RISC CPU which intel killed a long time ago but looks like it’s making a comeback.  

After fixing up my ALU I am going to start on my kits that will revolutionize the way people understand how computers work and not be fooled by the propaganda on tv and what they say is new but really is crap. Also having a 100% open source system means you know whats in it and know that they cant be tracking you in any way because there will be no identifying items since you made them all your self. 

RAM16K 16bit


Activity 29:
Ram16k 16bit. All is well 
An issue I found with the simulator is that the error are at the bottom and cant always see it because it’s a java window that is not that user friendly. The errors should pop up in a separate dialog box. Easy to read and refer back to.  
Just had to redo some math and got this one to work.

RAM4k


Activity 28:
RAM4k 16bit my prediction is that it will be just the same as the last one. Just a little copy and paste with a few changes here and there and tada the RAM4k. 
Search Engine Submission - AddMe