Omnimaga

General Discussion => Technology and Development => Other => Topic started by: Quigibo on November 28, 2010, 05:12:49 am

Title: Anyone use Logisim?
Post by: Quigibo on November 28, 2010, 05:12:49 am
Have you ever wanted to build your own computer?  And by build your own, I mean from scratch... literally wiring logic gates and registers together.  Its really fun actually, I just finished a project for school where I had to not only build my own instruction set architecture, but then use that machine language that I created to write an assembly program for conway's game of life and then run it in the simulator.

Its really rewarding.  I remember when I first learned to program BASIC on the calculator and it felt cool I could actually program the thing.  And then I learned assembly and I though it was cooler that I was actually writing the lowest level of machine programming.  But then we had to use Logisim and now its even cooler to actually wire everything together to create your own instruction set!

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

Its relatively easy to use and its in java so it will run on any platform.  I dare someone to try to make a z80 CPU!  Its actually much harder than the architecture I created since mine had a single sized, single clock cycle instruction set for simplicity, similar to ARM.
Title: Re: Anyone use Logisim?
Post by: Runer112 on November 28, 2010, 07:44:08 am
I've been debating trying to make a Z80 CPU in Minecraft (http://www.minecraft.net/). It would be crazily difficult and probably run at most at a few cycles per second, but it would still be awesome.
Title: Re: Anyone use Logisim?
Post by: Munchor on November 28, 2010, 08:56:35 am
Have you ever wanted to build your own computer?  And by build your own, I mean from scratch... literally wiring logic gates and registers together.  Its really fun actually, I just finished a project for school where I had to not only build my own instruction set architecture, but then use that machine language that I created to write an assembly program for conway's game of life and then run it in the simulator.

Its really rewarding.  I remember when I first learned to program BASIC on the calculator and it felt cool I could actually program the thing.  And then I learned assembly and I though it was cooler that I was actually writing the lowest level of machine programming.  But then we had to use Logisim and now its even cooler to actually wire everything together to create your own instruction set!

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

Its relatively easy to use and its in java so it will run on any platform.  I dare someone to try to make a z80 CPU!  Its actually much harder than the architecture I created since mine had a single sized, single clock cycle instruction set for simplicity, similar to ARM.

I don't see any fun on that, but that's just me.

I tend to hate hardware and processors, graphic cards, LCD's are a bunch of words that I don't like to use. I prefer programming and software
Title: Re: Anyone use Logisim?
Post by: calcdude84se on November 28, 2010, 09:49:43 am
Nice fine, Quigibo! :) I've heard of Logisim before, and used it, but then I forgot about it x.x
I remember seeing a computer built in Logisim somewhere... Let me find it ;D
Edit: here it is: http://da.vidr.cc/projects/subleq/ (http://da.vidr.cc/projects/subleq/) It's a OISC (One Instruction Set Computer (http://en.wikipedia.org/wiki/One_instruction_set_computer)), so it's small, but still :P I think the creator even wrote several small programs for it ;D
Title: Re: Anyone use Logisim?
Post by: jnesselr on November 28, 2010, 10:10:36 am
Nice find quigibo.  I might try it out! It looks like you can make circuitry for it. I wonder if it has some built-in processors, too.
Title: Re: Anyone use Logisim?
Post by: AngelFish on November 28, 2010, 10:28:20 am

I don't see any fun on that, but that's just me.

I tend to hate hardware and processors, graphic cards, LCD's are a bunch of words that I don't like to use. I prefer programming and software

I can't even understand that. I'm very much a hardware guy and I did have the chance to take apart a simple computer down to the individual transistors a little while back. Very interesting.
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on November 28, 2010, 10:30:47 am
Personally I'M more a designing person than hardware, and I'm a bit on the programming side too. I guess it depends of people. I personally am not good with my hands. This software seems pretty interesting, although I would probably not get most of it.
Title: Re: Anyone use Logisim?
Post by: jnesselr on November 28, 2010, 10:48:03 am
I'm actually using it right now.  It's an amazing piece of software!
Title: Re: Anyone use Logisim?
Post by: ztrumpet on November 28, 2010, 11:50:31 am
This sounds really cool.  What class was this for, Quigibo? ;D
Title: Re: Anyone use Logisim?
Post by: Goplat on November 29, 2010, 12:50:29 pm
I used Logisim in a class a year or two ago. I made this little puzzle with it in my spare time: try to light up all the LEDs. (it's too easy, I know)
Title: Re: Anyone use Logisim?
Post by: AngelFish on November 29, 2010, 12:57:28 pm
Its relatively easy to use and its in java so it will run on any platform.  I dare someone to try to make a z80 CPU!  Its actually much harder than the architecture I created since mine had a single sized, single clock cycle instruction set for simplicity, similar to ARM.

Here's a partial circuit diagram for the z80

(http://www.hanssummers.com/computers/newz80/circuit/circuit4m.gif)

Good luck drawing that  :P
Title: Re: Anyone use Logisim?
Post by: aeTIos on November 29, 2010, 12:58:49 pm
Wow.
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on November 29, 2010, 11:28:56 pm
Darn that must be tricky to learn for someone who never did hardware or low level stuff. X.x
Title: Re: Anyone use Logisim?
Post by: jnesselr on November 30, 2010, 06:57:28 am
I've been using Logism for a bit now.  It's pretty good in it's own respects.  My favorite tool is the tunnel tool.  It's nice because instead of a long wire, it's like a wireless transmitter and receiver in one thing that communicates with each other.  So, any wires the same tunnels are connected to are connected through the tunnels.

I'd give this app 9/10. It's fairly fast even though it uses java.  It has had a few bugs when I've been using it. Other than that, it's really great.
Title: Re: Anyone use Logisim?
Post by: Builderboy on November 30, 2010, 11:49:40 pm
This is amazingly fun!  I've been building since i've had no internet for a while, but i have created a sort of z80-ish cpu!  It by no means has the same commands as the z80, but the syntax is inspired greatly by it.  It has 4 registers, A B C and D, 256 bytes of program ROM, and 256 bytes of general RAM for manipulation.  It can do things like load numbers to and from register and RAM, it can do math such as adding and multiplication in register, and it has some program control like jumps, conditional jumps, and the infamous Decrement B jump if not Zero command ^^ Which i am very proud of.   It also has zero and carry flags, inspired by z80 again

Here is a zip with the full command set and file, it also has a small 5 byte program included.

Title: Re: Anyone use Logisim?
Post by: jnesselr on December 01, 2010, 07:25:10 pm
Very nice. I'll try this right away!

EDIT: This is incredible!
Title: Re: Anyone use Logisim?
Post by: Builderboy on December 01, 2010, 07:27:06 pm
Note that you have to compile the code yourself into hex using the binary table :P registers are 00 for A, 01 for B 10 for C and 11 for D.  And for jumps 00 is jump if Zero, 01 is jump if carry, 10 is jump if Not Zero, and 11 is jump if not carry
Title: Re: Anyone use Logisim?
Post by: jnesselr on December 01, 2010, 07:31:02 pm
Note that you have to compile the code yourself into hex using the binary table :P registers are 00 for A, 01 for B 10 for C and 11 for D.  And for jumps 00 is jump if Zero, 01 is jump if carry, 10 is jump if Not Zero, and 11 is jump if not carry
When I was making one, I only used 4 registers too. I tried figuring out how to change the registers too.
Title: Re: Anyone use Logisim?
Post by: Builderboy on December 01, 2010, 07:38:26 pm
Yeah, and plus with my cpu every instruction takes 8 clock cycles no matter what (even the 2 byte ones) so there is no speed increase gained by using registers.  Buuut they are the only way to do math and stuff :P
Title: Re: Anyone use Logisim?
Post by: thepenguin77 on December 01, 2010, 07:48:09 pm
Well, I've spent the last two days making a cpu. I must say it is pretty interesting. I have managed to get 5 registers and the commands nop; ld register, imm; jp imm; ld (imm), a; and ld a, (imm). But I have been halted by what I believe to be a glitch in the program.

My PC is set to latch input on the falling edge of the clock. But now and then, it latches on the rising edge! This makes my program fail pretty bad because there is no usable data on the rising edge. My program just loops back to 0000.
Title: Re: Anyone use Logisim?
Post by: Builderboy on December 01, 2010, 07:50:19 pm
Hurmm that sounds weird, could you post a file and we could all take a look at it?
Title: Re: Anyone use Logisim?
Post by: thepenguin77 on December 01, 2010, 07:55:45 pm
This might scare the crap out of you, but here it is. The whole cpu is on one screen.

Important stuff:
All commands take 4 clocks.

00 nop
01 ld a, imm
02 ld b, imm
03 ld c, imm
04 ld d, imm
05 jp imm
06 ld (imm), a
07 ld a, (imm)

The program I have loaded is this.
Code: [Select]
ld a, $69
ld ($0102), a
ld a, $FF
ld a, ($0102)
Title: Re: Anyone use Logisim?
Post by: jnesselr on December 01, 2010, 07:57:29 pm
I don't think he gave the file.
Title: Re: Anyone use Logisim?
Post by: thepenguin77 on December 01, 2010, 08:04:29 pm
You would be correct. Just take off the .txt extension.
Title: Re: Anyone use Logisim?
Post by: Builderboy on December 01, 2010, 08:17:40 pm
Ah, found the issue, and its not logisim.  Try attaching a regular counter onto the same clock as PC is attached to.  When the 'glitch' occurs, the counter increments twice.  This tells me there is some logical errors in your cpu that is causing the clock to quickly go from down, to up, back to down, then back up again.

EDIT: I have narrowed down the error further, it seems to be coming from the pin 6th from the right from the phase 1 box.  Also, you might want to look into multiplexers, as they do exactly what your bit selectors do
Title: Re: Anyone use Logisim?
Post by: thepenguin77 on December 01, 2010, 08:42:06 pm
Yay, I fixed it. The current instruction register was outputting a 6 just before it got changed to 1. So I just bypassed it for phase 1 and it worked. Off to make a text routine.

Thank you
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 08:51:49 pm
Oh my wow. Screw programming in hex, I am already loving this. Thank you, I am going to have so much fun with this.
Title: Re: Anyone use Logisim?
Post by: Builderboy on December 01, 2010, 08:58:08 pm
Yay, I fixed it. The current instruction register was outputting a 6 just before it got changed to 1. So I just bypassed it for phase 1 and it worked. Off to make a text routine.

Thank you

No problem :) Did you check out multiplexers and demultiplexers?  I think they could greatly speed up and simplify your code :)
Title: Re: Anyone use Logisim?
Post by: AngelFish on December 01, 2010, 09:01:14 pm
Oh my wow. Screw programming in hex, I am already loving this. Thank you, I am going to have so much fun with this.

Next thing we know, you'll be presenting a hardware mod that lets you flip gates in the z80 :P
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 09:01:15 pm
What is the logic called where if both bits are the same, the output bit is 1. Isn't XOR 1 if the inputs are different?
Title: Re: Anyone use Logisim?
Post by: AngelFish on December 01, 2010, 09:02:50 pm
What is the logic called where if both bits are the same, the output bit is 1. Isn't XOR 1 if the inputs are different?

It's the AND operation, otherwise denoted by ∧.

Darn it, not evil anymore.
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 09:08:35 pm
AND? AND only outputs a 1 if both bits are 1, doesn't it? What if it outputs 1 if both bits are 0, too?
Title: Re: Anyone use Logisim?
Post by: AngelFish on December 01, 2010, 09:11:02 pm
Oh, I thought you meant iff the bits were both 1. You'd probably have to do multiple gates chained together.
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 09:12:46 pm
Nevermind, I got it... XNOR

I made the circuit already, I just wanted to know what it was called :D
Title: Re: Anyone use Logisim?
Post by: Builderboy on December 01, 2010, 09:54:53 pm
Note to everybody using Logisim, it uses an advanced propagation routine that might trip a few people up.  For example try building this circuit.  have a regular clock, and attach it to an AND gate in two places.  Negate on of the wires with a NOT gate.  Take the output of the AND gate and attach it to an incremental register.  The register should never increase because the AND gate can never be satisfied right?

Wrong

For the brief milisecond that it takes for the clock pulse to travel through the NOT gate, the AND gate will be true for a tiny second and increment the counter.  This will not show in Logisim, as it only shows beginning and end states, and can lead to much confusion.  So remember, always make sure your logic is very solid and well build or else it might turn on you!
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 10:16:46 pm
Okay, another logic problem...
(1,1)=0
(1,0)=1
(0,1)=0
(0,0)=0

If I use NOT on the second number, and then use AND, I get this result...
Title: Re: Anyone use Logisim?
Post by: calc84maniac on December 01, 2010, 10:17:55 pm
Okay, another logic problem...
(1,1)=0
(1,0)=1
(0,1)=0
(0,0)=0

If I use NOT on the second number, and then use AND, I get this result...
How is that a problem? That looks perfectly correct to me...
Title: Re: Anyone use Logisim?
Post by: Builderboy on December 01, 2010, 10:18:34 pm
I think he's asking what the gate is?  Note that not all 16 combinations have names :)
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 10:19:39 pm
Oh, okay. Thanks! I am having so much fun with this!
Title: Re: Anyone use Logisim?
Post by: Runer112 on December 01, 2010, 10:25:32 pm
I think he's asking what the gate is?  Note that not all 16 combinations have names :)

http://en.wikipedia.org/wiki/Truth_table#Truth_table_for_all_binary_logical_operators (http://en.wikipedia.org/wiki/Truth_table#Truth_table_for_all_binary_logical_operators) :P
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 10:29:37 pm
Thanks!

Converse non-implication?
Title: Re: Anyone use Logisim?
Post by: AngelFish on December 01, 2010, 10:32:28 pm
Actually that would be logical implication  ;)
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 10:36:06 pm
Hmm? It is only the value of p if q is not true, so it is "Material nonimplication" I think...
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on December 01, 2010, 11:32:03 pm
By the way, I wonder if that software can be useful in helping the development of something like OTCalc or if it's just limited to motherboards, processors and the like?
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 01, 2010, 11:37:47 pm
Well, this is definitely giving us experience in designing the thing. We can make our own processors!
Title: Re: Anyone use Logisim?
Post by: willrandship on December 02, 2010, 12:00:44 am
 ;D ;DI just happen to be doing exactly this, with a twist: It's my own CPU, with its own handbuilt gates. It also runs in base 4.

I designed and built all the gates, and an adder, last year. I built an AND, OR, and NOT gate. ANDs comprise an OR and three NOTs, two on in, one on out. It works.


It really works, even in binary :P it also follows all proofs applied to Binary logic. XORs can't exist, really, unless someone can come up with a way.

base 4 computing is the way of the future. This design will be expandable to any base you want, but higher bases mean higher voltages, and base 4 is already reaching fairly unsafe (~36 V in the adder) levels anyways.

I made the first gates for a State Science fair project, got second place. This year I'm making a programmable CPU.  ;D

You may be wondering-why base 4?
Spoiler For Spoiler:
because base 4 gives you ^2 power for your components. A 4-bit quaternary CPU has as many options as a binary 16-bit processor, but has a similar component count to a 4-bit binary CPU. This is because base 4's 4 bit would be like 0231 for commands, while binary 4-bit would be 0110.

By the way, my logic in base 4 works like this:
AND=take lower number
Or=Take higher number
Not=invert number across middle

I just wish it was easier. This design stuff is hard! My first design used lots of opamps, but my OR gate now only needs 2 components.
Title: Re: Anyone use Logisim?
Post by: AngelFish on December 02, 2010, 12:05:26 am
Xor:

00000:0
00001:1
00010:1
00100:0
00101:0

And you get the idea. Of course that actually describes a 4 input binary XOR, but it *should* be applicable to Quaternary.

I prefer Ternary myself, though.

EDIT: There are 65,536 logical operators in Quaternary. Picking a XOR out of that would be difficult.
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on December 02, 2010, 12:06:35 am
Well, this is definitely giving us experience in designing the thing. We can make our own processors!
Oh actually OTCalc used a pre-made one.
Title: Re: Anyone use Logisim?
Post by: willrandship on December 02, 2010, 12:07:37 am
Ternary (trinary, right? both are correct) has disadvantages, namely that it isn't easily compatible with binary or hex. quaternary is easily converted to either. Other than that, I can't really think of any reason to choose either except that higher base=more data for components.
Title: Re: Anyone use Logisim?
Post by: SirCmpwn on December 02, 2010, 12:19:06 am
This is really awesome!  I've been playing around with it a little for about an hour, and I've been making my own processor.  I have a nice set up for registers, I think, but I'm not sure how I should start interpreting opcodes.  Thoughts?

EDIT: I think I have figured out a way, and uploaded the new circuit with a demonstration.
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 02, 2010, 01:12:14 am
Okay, I haven't checked yours yet, but here's mine :D It doesn't do much and my notes are rather sparse, sorry. All the stuff has to be input manually at the moment, but I am working on that :D
Title: Re: Anyone use Logisim?
Post by: Quigibo on December 03, 2010, 05:48:58 am
Now that I turned in my project and had it graded, I think I can upload it online.  Here is the CPU I made.  I spent a lot of time organizing it into subcircuits which is a really helpful technique.  It's a 16-bit RISC processor with 4 registers and there's about 20 different instructions.

I also have a conway's game of life program that can be loaded into the rom.  Its really slow since it has to go pixel by pixel so it takes about a minute for each generation at the fastest clock speed.  The first 12 words of ram are the screen buffer.  A good starting configuration to test is the first 4 bytes: 0x0000, 0x0040, 0x0050, 0x0060 which makes a glider.  Feel free to use elements of this in your designs if you're having trouble with any part.
Title: Re: Anyone use Logisim?
Post by: SirCmpwn on December 03, 2010, 08:45:11 am
Very nice!  Looks quite detailed.  I'm only getting a basic grasp of how to make a CPU, so mine is still very basic.  But I did figure out a way of having polybyte opcodes.  My setup has a PC which reads in ROM on every clock cycle, and increments PC.  You can't change and read the address from ROM on a single clock, so this is the method I devised:
0. If the flip flop is set, skip to 3
1. Read in and interpret the opcode.
2. If it is multibyte, toggle a flip flop value with the instruction name
3. Execute the instruction, reset the flip flop
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on December 03, 2010, 11:37:40 am
Oh, Cool! I didn't know I could do that with the different parts of the circuit! Here I've been working with an increasingly cluttered mess! Well, I have no experience wit this kind of a thing, so I am still trying to figure things out with using the clock for the interpreter. I have it so that the interpreter recognises loads between registers, I just need to use a clock to time things just right... Well, I could just redesign some of the circuit and that would make it run faster, but it would use more components :(
Title: Re: Anyone use Logisim?
Post by: Madskillz on December 03, 2010, 02:57:28 pm
Ah logisim...I had to make a garage door opener with it for a final project in one of my classes.
Title: Re: Anyone use Logisim?
Post by: LordConiupiter on December 03, 2010, 04:19:42 pm
this is really very cool! I have worked with a program that looks like it, but didn't do anything usefull, and was full of bugs. really stupid bugs. I like hardware, but prefer software. I will use this program one day, that's for sure!
Title: Re: Anyone use Logisim?
Post by: SirCmpwn on December 03, 2010, 04:59:10 pm
Here I've been working with an increasingly cluttered mess!
Mine looks like a cluttered mess, but I really don't care, because once I start actually interpreting instructions, I'm going to delete most of what I already have.  It's mostly just a means of testing the individual components and concepts behind the processor.  What I have right now is a simple interpreter (used to test out various methods of interpreting instructions), a LCD toggle pin (used to test actually performing an instruction), an instruction flip-flop for testing out the ideas I mentioned earlier, which is used to modify registers in my register subcircuit.  Up until today, the register subcircuit worked with only 4 8-bit registers, but I have an experimental version that allows you to combine two of the 8-bit registers into a 16-bit register.  (So you can use A, B, C, D, AB and CD)
Once I finish the register subcircuit, I'll upload it here, because it could be quite useful to some people.
Title: Re: Anyone use Logisim?
Post by: Builderboy on December 03, 2010, 08:11:13 pm
Alright so i have been exremely busy working on my CPU, and it is almost finished.  It currently has about 40 different oppcodes, with many different arguments.  The features it currently supports are these:

Hardware:
4 Registers
256 bytes of program ROM
256 bytes of memory RAM
8 byte address stack
Memory mapped LCD
text output
text input
numerical input
Zero and carry flags for conditions

Commands:
Loading Registers into registers
Loading constants into registers
Loading constants into RAM
Loading Ram into registers
Loading ROM into registers
Loading random numbers into register
Loading random numbers into RAM
Jumping to other parts in the program
Jumping conditionally to other parts in the program
Calling other parts of the program
Calling conditionally other parts in the program
Returning from calls
Doing arithmetic on a register and A (Adding/Subtract/Multiply/Divide/Mod/XOR/AND/OR)
Doing arithmetic on a constant and a register
Doing arithmetic on a register (increment/decrement/Clear/Negae/Shift Right/Left with carry/Shift right/left circularly)
Decrement B and Jump to address if not zero (for loops)
refresh the LCD
Output a character stored in a register
Clear the text screen
Terminate the program
Terminate on a condition
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on December 03, 2010, 11:11:08 pm
Awesome! :D
Title: Re: Anyone use Logisim?
Post by: nemo on December 03, 2010, 11:20:22 pm
i have come up with the definition of logisim.

Logisim: when a computer emulates a computer which runs a program that allows a user to create a computer and then emulate it.

breakdown:
first, you start with your hardware computer, which is emulating the JVM (java virtual machine, what java runs on), which is running the java program, which you can then create hardware which you can emulate.
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on December 03, 2010, 11:24:06 pm
Ah, right, that makes a lot of emulators nested in each others. ;D

Kinda like if TI-Boy SE ran on the Nspire: It would be a GB emu running in a 84+, running in a TI-Nspire, running in Ncubate or Goplat's emu, running on a virtual machine because you have Mac OS. ;D
Title: Re: Anyone use Logisim?
Post by: JosJuice on December 04, 2010, 04:25:53 am
Ah, right, that makes a lot of emulators nested in each others. ;D

Kinda like if TI-Boy SE ran on the Nspire: It would be a GB emu running in a 84+, running in a TI-Nspire, running in Ncubate or Goplat's emu, running on a virtual machine because you have Mac OS. ;D
What about:
Linux > (Wine (which isn't really emulation but lol)) > Windows > Wii > DS > TI-84+ (or is that emulator TI-83+ only?) > Game Boy
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on December 04, 2010, 03:43:55 pm
I'm not sure if WabbitDS is compatible with the 84+. I think the last update was in 2007 and it was more limited than the Windows Wabbit.
Title: Re: Anyone use Logisim?
Post by: AngelFish on April 01, 2011, 03:04:30 pm
Sorry for the necro. Turns out that I have to build a microprocessor for one of my classes, so I've been playing around with circuits a lot lately. Here's one of my favorite things: An 8 bit barrel shifter capable of shifts up to 15 bits (left only at the moment) as well as changing between rotating the input (MSB->LSB), 0->LSB, and 1->LSB shifts. The circuit is absolutely massive though. Here's what I managed to fit on one screen.

(http://img.removedfromgame.com/imgs/Shifter.png)
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on April 01, 2011, 04:46:21 pm
Hehe, that reminds me... I was working on either a 16-bit or 32-bit processor... I should get back to work on that x.x
Title: Re: Anyone use Logisim?
Post by: Ashbad on April 01, 2011, 04:50:04 pm
I should try and make a 128 bit processor.. :)
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on April 01, 2011, 04:55:33 pm
I think I will stick with 8 or 16 bit... Maybe a Z80 :D
Title: Re: Anyone use Logisim?
Post by: jnesselr on April 01, 2011, 10:59:28 pm
would a 128 bit run faster than a 64 bit? I mean really, you're talking about having to array larger and larger pieces of memory, etc.  Eventually, it might even out where the number of bits are the max for max processor speed.  Unless I don't know what the heck I'm talking about, in which case, ignore me please.
Title: Re: Anyone use Logisim?
Post by: Xeda112358 on April 02, 2011, 01:13:30 am
(ignored) :P I see what you mean... That is why I think 32-bit is about as high as we need for now.
Title: Re: Anyone use Logisim?
Post by: Eeems on April 02, 2011, 02:07:59 am
Well I did some looking into making a z80 replica of it, and this site may be of use http://www.z80.info/
Some circuit diagrams: http://www.z80.info/z80core3.htm http://www.z80.info/z80core4.htm
Nothing seems to actually show how the cpu is setup though, just systems including it. I'm going to do some more digging.
Title: Re: Anyone use Logisim?
Post by: nitacku on April 02, 2011, 03:20:28 am
Attached is a simple multi-cycle data path used in one of my classes.
One image shows the data path without pipelining, the other with.

The LC-2K is an 8-register, 32-bit computer.  All addresses are
word-addresses.  The LC-2K has 65536 words of memory.  By assembly-language
convention, register 0 will always contain 0 (i.e. the machine will not enforce
this, but no assembly-language program should ever change register 0 from its
initial value of 0).

There are 4 instruction formats (bit 0 is the least-significant bit).  Bits
31-25 are unused for all instructions, and should always be 0.

R-type instructions (add, nand):
    bits 24-22: opcode
    bits 21-19: reg A
    bits 18-16: reg B
    bits 15-3:  unused (should all be 0)
    bits 2-0:   destReg

I-type instructions (lw, sw, beq):
    bits 24-22: opcode
    bits 21-19: reg A
    bits 18-16: reg B
    bits 15-0:  offsetField (a 16-bit, 2's complement number with a range of
                    -32768 to 32767)

J-type instructions (jalr):
    bits 24-22: opcode
    bits 21-19: reg A
    bits 18-16: reg B
    bits 15-0:  unused (should all be 0)

O-type instructions (halt, noop):
    bits 24-22: opcode
    bits 21-0:  unused (should all be 0)

------------------------------------------------------------------------------
Table 1: Description of Machine Instructions
------------------------------------------------------------------------------
Assembly language       Opcode in binary                Action
name for instruction    (bits 24, 23, 22)
------------------------------------------------------------------------------
add (R-type format)     000           Add contents of regA with
                                                contents of regB, store
                                                results in destReg.

nand (R-type format)    001           Nand contents of regA with
                                                contents of regB, store
                                                results in destReg.  This is
                                                a bitwise nand; each bit is
                                                treated independently.

lw (I-type format)      010             Load regB from memory. Memory
                                                address is formed by adding
                                                offsetField with the contents
                                                of regA.

sw (I-type format)      011            Store regB into memory. Memory
                                                address is formed by adding
                                                offsetField with the contents
                                                of regA.

beq (I-type format)     100            If the contents of regA
                                                and regB are the same,
                                                then branch to the address
                                                PC+1+offsetField,
                                                where PC is the address
                                                of the beq instruction.

jalr (J-type format)    101              First store PC+1 into regB,
                                                where PC is the address of the
                                                jalr instruction.  Then branch
                                                to the address now contained in
                                                regA.  Note that this implies
                                                if regA is the same as regB,
                                                the processor will first store
                                                PC+1 into that register, then
                                                end up branching to PC+1.
                                                In other words, FIRST the value
                                                of PC+1 gets stored into regB,
                                                then SECOND, the execution
                                                jumps to the address in regA.
                                                That means that if the two
                                                registers specified are the
                                                same, then it will first put
                                                PC+1 into the register, and
                                                then jump to the value in that
                                                register.  The net effect will
                                                be jumping to PC+1.

halt (O-type format)    110            Increment the PC (as with all
                                                instructions), then halt the
                                                machine (let the simulator
                                                notice that the machine
                                                halted).

noop (O-type format)    111           Do nothing.
-------------------------------------------------------------------------------

If anyone wants to actually create something, this a good example to start with. :P

Title: Re: Anyone use Logisim?
Post by: aeTIos on April 05, 2011, 02:36:31 pm
Cool!
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 06, 2011, 05:02:18 am
I hate that there are no diodes in Logisim. makes some things so much harder :\
Title: Re: Anyone use Logisim?
Post by: calcdude84se on April 06, 2011, 06:12:17 am
Diodes? Logisim simulates the logic portion, not the electric portion. ;)
What are you trying to do, anyway, that'd require them? ???
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 06, 2011, 06:41:25 am
I want to make a little 7segment display calculator... But I can't figure out how to do. It has to do with bit shifters
Edit: wait, does the buffer the same as a diode? :)
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 06, 2011, 02:10:11 pm
I found this, might be useful for those who want to create a z80?
(http://www.z80.info/gfx/Circuit_diagram_2A_3A.gif)
Title: Re: Anyone use Logisim?
Post by: AngelFish on April 06, 2011, 02:23:29 pm
That's a whole Commodore64, I believe. The z80 is the medium sized block on the right left side of the circuit.

EDIT: Apparently I don't know which hand is my right one...
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 06, 2011, 02:26:01 pm
Of*ck lol. Nah, someone make a commodore64?

and wow it is not really big O.O
Title: Re: Anyone use Logisim?
Post by: z80man on April 06, 2011, 02:58:06 pm
Has anyone considered yet making a logism like program for a calc. You could have scrolling screen and use a tile mapper for all of the circuits. I might try this for the Prizm later on, but this could be a good 83+ project to try for someone.
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 06, 2011, 03:39:47 pm
Yes, SirCmpwn was talking about it...
search for "logisim" and you get it :)
Title: Re: Anyone use Logisim?
Post by: willrandship on April 06, 2011, 04:02:19 pm
Did you notice the z80 block? That's going to be BIG.

I need Voltage values for most of my electronic playthings, so I usually use gSchem and just make it.
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 07, 2011, 04:35:58 am
Is gSchem also for Windows?
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 08, 2011, 02:15:50 pm
Hi, I have a problem with this,

I want to make a little CPU/processor and I dont seem to get it working without tons of comparators.
Attached is what I have now.

Can anyone explain the basics of creating a CPU?

Thanks!
Title: Re: Anyone use Logisim?
Post by: AngelFish on April 08, 2011, 02:55:06 pm
Okay, here's that 8 bit comparison circuit I was talking about. Each hex keyboard represents one nibble of a register. If you want to compare a register to multiple numbers, then load a second register with the number and run them both through this circuit. Here's a direct link (http://img.removedfromgame.com/imgs/AETIOS.png)

(http://img.removedfromgame.com/imgs/AETIOS.png)

It works by XORing each of the bits of both operands together. More later before you go.
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 08, 2011, 02:56:18 pm
thanks!
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 09, 2011, 10:42:11 am
Qwerty, the squares are probes?
EDIT: I dont get it, I made it in Logisim and get other outputs. please help, it is attached.
Title: Re: Anyone use Logisim?
Post by: Ashbad on April 09, 2011, 10:49:39 am
This actually should work correctly.  Would you like me to explain it in depth? ;)

Basically, one at a time, it compares corresponding bits in each register's nibble and xors them to compare them.  Then it does this with the second nibble's bits.  It then creates two new midway nibble values for another comparison -- AND.  If all of the bits in the midway nibble are correct, return 1 - else return 0.  Do this with the other nibble as well and you have 2 midway bit values -- in this setup, a 0 and a 1 based on your register's values shown.  It uses some form of what looks like AND to see if they are both the same, and returns 1 if so, 0 if not. 

TL;DR returns 1 if the two registers are exactly equal, 0 otherwise ;)
Title: Re: Anyone use Logisim?
Post by: aeTIos on April 09, 2011, 11:10:30 am
Can anyone edit my Logisim thing and post it so that it works? I dont get it working ARGH
Title: Re: Anyone use Logisim?
Post by: SirCmpwn on April 09, 2011, 12:11:39 pm
Yes, SirCmpwn was talking about it...
search for "logisim" and you get it :)
Yeah, I started on some stuff, but eventually dropped it because it seemed infeasible.
Title: Re: Anyone use Logisim?
Post by: marinjoses on April 27, 2011, 10:56:17 am
Greetings to everyone!
Does anybody know how to implement http://en.wikipedia.org/wiki/LC-3 through the logisim?
Thanks!
Title: Re: Anyone use Logisim?
Post by: AngelFish on April 27, 2011, 02:39:29 pm
No, but might I recommend my incomplete tutorial (http://ourl.ca/10188/195863) as a partial substitute for the ideas?
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on April 27, 2011, 08:02:40 pm
Heya and welcome on the forums, by the way. :D
Title: Re: Anyone use Logisim?
Post by: marinjoses on May 01, 2011, 06:48:44 pm
Heya and welcome on the forums, by the way. :D
Thanks!
Title: Re: Anyone use Logisim?
Post by: Snake X on May 01, 2011, 09:51:35 pm
I wonder if i'll be using logism in my technology systems class next year.. that would be exciting if so! :P
Title: Re: Anyone use Logisim?
Post by: DJ Omnimaga on May 21, 2011, 03:43:48 am
Hmm... I wonder what this topic was doing in the Java programming section? O.O

Moved.
Title: Re: Anyone use Logisim?
Post by: Builderboy on May 21, 2011, 10:17:33 am
It was written in Java :D
Title: Re: Anyone use Logisim?
Post by: Spyro543 on May 21, 2011, 04:00:50 pm
This program is AWESOME!!!! I just wonder how to make wire cross but not connect...
Title: Re: Anyone use Logisim?
Post by: Spyro543 on May 22, 2011, 08:29:41 am
I have no idea what this is I made this out of pure boredom! ;D