[color=#008000]
;set DATA to any value or just 0x00
00: 00001111 00000001 ;Load 1 to A
02: 00000100 00000111 ;Store A to 07
04: 00000111 00000111 ;Load 07 to A
06: 00001100 DATA ;Write A to output
08: 00000010 00000111 ;Add 07 to A
0a: 00000100 00000111 ;Store A to 07
0c: 00000101 11110011 ;BranchZero to 0x00 (-13)
0e: 00001101 11110101 ;BranchAlways to 0x04 (-11)[/color])[/color]
it makes pretty lights for your output... lol
(aka, it flashes each bit from the 1st to 8th then loops)
That'd be awesome! But I'm still not done with it yet, so I don't know if future changes could affect the code. Yeah, branching just increases the PC by the given amount. The PC increments using its own adder. There's a block diagram at http://lazcraft.tumblr.com/post/1489658879/block-diagram-of-the-cpu-ive-put-coloured-wires. Yep, 8 bit memory space. I'll have a look at that schematic, might be good to add ROM.
I got another one that is half the space. Got a video of it up on my youtube space Form Link and I walk around showing stuff on it. I just tend to build compoentents like shift regesters, rom, ram banks. Things that arn't very showy and too technical:P
Oh, Here is my PC counter. Been experimenting with the Law counter. I found that if you "reset" the counter. Increment it by one, you can then load it up like a register. I was going to stack two of these together and make a 2 deep PC stack, but thought it was a bit overkill:P Switch to the left will reset if all the inputs are low. Switch to the right will output the inverted register. I ran lines so you can stack these things left to right if need be. But I might just end up putting in a full adder to some flipflops. I really want to do an indirect jumps:P
we need to make a thread so people can work together on a pipelining CPU so we can speed up this redstone lag.
then again, does anyone how exactly the redstone algorithms work? (speed wise)
we need to make a thread so people can work together on a pipelining CPU so we can speed up this redstone lag.
then again, does anyone how exactly the redstone algorithms work? (speed wise)
That'd be awesome! But I'm still not done with it yet, so I don't know if future changes could affect the code. Yeah, branching just increases the PC by the given amount. The PC increments using its own adder. There's a block diagram at http://lazcraft.tumblr.com/post/1489658879/block-diagram-of-the-cpu-ive-put-coloured-wires. Yep, 8 bit memory space. I'll have a look at that schematic, might be good to add ROM.
I got another one that is half the space. Got a video of it up on my youtube space Form Link and I walk around showing stuff on it. I just tend to build compoentents like shift regesters, rom, ram banks. Things that arn't very showy and too technical:P
Oh, Here is my PC counter. Been experimenting with the Law counter. I found that if you "reset" the counter. Increment it by one, you can then load it up like a register. I was going to stack two of these together and make a 2 deep PC stack, but thought it was a bit overkill:P Switch to the left will reset if all the inputs are low. Switch to the right will output the inverted register. I ran lines so you can stack these things left to right if need be. But I might just end up putting in a full adder to some flipflops. I really want to do an indirect jumps:P
Looking at how everything is going on this thread, I might change things around and put a block of ROM in for easy programming and have at addessed as the first lot of memory, then have the RAM continuing on from the end of the ROM. Then there can be some addresses set aside for inputs, like a keyboard or something, and some addresses for output.
Looking at how everything is going on this thread, I might change things around and put a block of ROM in for easy programming and have at addessed as the first lot of memory, then have the RAM continuing on from the end of the ROM. Then there can be some addresses set aside for inputs, like a keyboard or something, and some addresses for output.
Yea it makes it much easier. I have been digging opencores.org and other sites for CPU's and by far having a separate program ROM path makes it easier. For instance, you could set your computer up to use a 12-bit word (4 bit op, 8 bit data) so you only have to do one fetch. Its how allot of micro controllers do it.
I don't mind the shared memory.
this is a small embedded system.
all our code SHOULD be hand written in assembly and be optimized for size.
this way we can have data and operands be one and the same if needed.
(for instance, ADD #10 are stored in addresses 0x00 and 0x01. you could LOAD 0x01 later if needed instead of needing to store data in another place in memory. You can also change what loops do by dynamically changing operands and even Opcodes)
In 1947, Grace Murray Hopper was working on the Harvard University Mark II Aiken Relay Calculator (a primitive computer).
On the 9th of September, 1947, when the machine was experiencing problems, an investigation showed that there was a moth trapped between the points of Relay #70, in Panel F.
The operators removed the moth and affixed it to the log. The entry reads: "First actual case of bug being found."
The word went out that they had "debugged" the machine and the term "debugging a computer program" was born.
In 2010, THE1LAZ created an 8bit CPU using redstone circuits in Minecraft (a kickass videogame).
On the 7th of November, 2010, when the machine was experiencing problems, an investigation showed that there was a pig trapped between the points of redstone torch #70, in the CPUs accumulator circuit.
THE1LAZ killed the pig and ate the ham. The entry reads: "Bacon is delicious."
The word went out that he had "depigged" the machine and the term "depigging a video game" was born.
This looks amazing! I can't wait to see the finished computer! even if it's a small, slowly, crap computer! My eyes are burning of excitement! Here, you can have my diamonds: 46 and my iron: 64+58
Does the CPU use signed bits or two complement? Working on implementing a SUBLEQ interpreter for this (to prove its Turing-completeness, not that it needs it), and need a reliable way to find negative numbers (to check if b <= 0).
My kingdom for a logical shift! Or one more instruction.
LOADi i001, A
ADDm m009, A
ADDm m009, A
STOREm A, m009
IOWRITE
ANDi i128, A
JZ 000 (-12)
JMP 002 (-12)
This will make the output ripple on from the least significant bit, then it'd go a bit nuts. With one more instruction it could be made to ripple off again and cycle. So frustrating! I'm already using the IOWrite operand as storage space!
Speaking of which, it feels a bit weird having a 4 bit opcode operating on the next 8 bit word. Wouldn't it make more sense to either use only 8 bits per instruction (and have specific instructions which perform on the next byte) or expand operations from 16 to 256?
Also, currently there's no way of making a variable jump other than self-modifying code - both operate directly with the operand value.
nice small program for so much output!
you could get rid of the check and branchzero since 128 + 128 = 0 since there is no 9th bit. no overflow etc.
(note: if you and 128 with any 2 power.. doesn't it return 0? and 128 and 128 = 128... right? or did i forget all basic digitals today?)
also, why are you multiplying twice?
my code segment that i said "makes the output pretty" outputs 1->2->4->8->16->etc and then wraps back to 1 after 256. basically toggling the lights from bottom to top.
Looking at how everything is going on this thread, I might change things around and put a block of ROM in for easy programming and have at addessed as the first lot of memory, then have the RAM continuing on from the end of the ROM. Then there can be some addresses set aside for inputs, like a keyboard or something, and some addresses for output.
Yea it makes it much easier. I have been digging opencores.org and other sites for CPU's and by far having a separate program ROM path makes it easier. For instance, you could set your computer up to use a 12-bit word (4 bit op, 8 bit data) so you only have to do one fetch. Its how allot of micro controllers do it.
Quote from otakudjr »
I don't mind the shared memory.
this is a small embedded system.
all our code SHOULD be hand written in assembly and be optimized for size.
this way we can have data and operands be one and the same if needed.
(for instance, ADD #10 are stored in addresses 0x00 and 0x01. you could LOAD 0x01 later if needed instead of needing to store data in another place in memory. You can also change what loops do by dynamically changing operands and even Opcodes)
I think what I'll do is leave it as just RAM for now, but once I've finished some other stuff, I'll add some ROM. It's a pain having to load all the code into the RAM, it would be nice to have it all just sitting on switches.
My kingdom for a logical shift! Or one more instruction.
I know, 16 bytes is just not enough!
Speaking of which, it feels a bit weird having a 4 bit opcode operating on the next 8 bit word. Wouldn't it make more sense to either use only 8 bits per instruction (and have specific instructions which perform on the next byte) or expand operations from 16 to 256?
The op codes are stored in bytes, so they're essentially an 8 bit opcode. Also, I might be adding instructions (eventually), so I want to leave a whole 8 bits for the instructions.
Also, currently there's no way of making a variable jump other than self-modifying code - both operate directly with the operand value.
I'm not exactly sure what you mean here. Are you talking about changing what gets added to another number? :S
;set DATA to any value or just 0x00
00: 00001111 00000001 ;Load 1 to A
02: 00000100 00000111 ;Store A to 07
04: 00000111 00000111 ;Load 07 to A
06: 00001100 DATA ;Write A to output
08: 00000010 00000111 ;Add 07 to A
0a: 00000100 00000111 ;Store A to 07
0c: 00000101 11110011 ;BranchZero to 0x00 (-13)
0e: 00001101 11110101 ;BranchAlways to 0x04 (-11)[/color])[/color]
it makes pretty lights for your output... lol
(aka, it flashes each bit from the 1st to 8th then loops)
EDIT: http://gicodewarrior.github.com/mc-cpu-emulator/demo/?code=0f%2001%0A04%2007%20%0A07%2007%0A0c%2000%0A02%2007%0A04%2007%0A05%20f3%0A0d%20f5
[color=#800000]EDIT: fixed to loop properly[/color]
This thread is now [Diamond]
I got another one that is half the space. Got a video of it up on my youtube space Form Link and I walk around showing stuff on it. I just tend to build compoentents like shift regesters, rom, ram banks. Things that arn't very showy and too technical:P
Oh, Here is my PC counter. Been experimenting with the Law counter. I found that if you "reset" the counter. Increment it by one, you can then load it up like a register. I was going to stack two of these together and make a 2 deep PC stack, but thought it was a bit overkill:P Switch to the left will reset if all the inputs are low. Switch to the right will output the inverted register. I ran lines so you can stack these things left to right if need be. But I might just end up putting in a full adder to some flipflops. I really want to do an indirect jumps:P
My new version of Redstone Simulator
Main Code Site: http://code.google.com/p/red-stone-simulator/
then again, does anyone how exactly the redstone algorithms work? (speed wise)
This thread is now [Diamond]
Anyone have a fast computer to host the server?
Looking at how everything is going on this thread, I might change things around and put a block of ROM in for easy programming and have at addessed as the first lot of memory, then have the RAM continuing on from the end of the ROM. Then there can be some addresses set aside for inputs, like a keyboard or something, and some addresses for output.
Yea it makes it much easier. I have been digging opencores.org and other sites for CPU's and by far having a separate program ROM path makes it easier. For instance, you could set your computer up to use a 12-bit word (4 bit op, 8 bit data) so you only have to do one fetch. Its how allot of micro controllers do it.
My new version of Redstone Simulator
Main Code Site: http://code.google.com/p/red-stone-simulator/
this is a small embedded system.
all our code SHOULD be hand written in assembly and be optimized for size.
this way we can have data and operands be one and the same if needed.
(for instance, ADD #10 are stored in addresses 0x00 and 0x01. you could LOAD 0x01 later if needed instead of needing to store data in another place in memory. You can also change what loops do by dynamically changing operands and even Opcodes)
This thread is now [Diamond]
On the 9th of September, 1947, when the machine was experiencing problems, an investigation showed that there was a moth trapped between the points of Relay #70, in Panel F.
The operators removed the moth and affixed it to the log. The entry reads: "First actual case of bug being found."
The word went out that they had "debugged" the machine and the term "debugging a computer program" was born.
In 2010, THE1LAZ created an 8bit CPU using redstone circuits in Minecraft (a kickass videogame).
On the 7th of November, 2010, when the machine was experiencing problems, an investigation showed that there was a pig trapped between the points of redstone torch #70, in the CPUs accumulator circuit.
THE1LAZ killed the pig and ate the ham. The entry reads: "Bacon is delicious."
The word went out that he had "depigged" the machine and the term "depigging a video game" was born.
add and sub are enough
with those you can multiply and divide.
if you're asking for hardware supported divide.. well thats ALOT more redstone...
This thread is now [Diamond]
Banner by Vilborg.
Click here for a vertical mob grinder!
nice small program for so much output!
you could get rid of the check and branchzero since 128 + 128 = 0 since there is no 9th bit. no overflow etc.
(note: if you and 128 with any 2 power.. doesn't it return 0? and 128 and 128 = 128... right? or did i forget all basic digitals today?)
also, why are you multiplying twice?
my code segment that i said "makes the output pretty" outputs 1->2->4->8->16->etc and then wraps back to 1 after 256. basically toggling the lights from bottom to top.
This thread is now [Diamond]
I think what I'll do is leave it as just RAM for now, but once I've finished some other stuff, I'll add some ROM. It's a pain having to load all the code into the RAM, it would be nice to have it all just sitting on switches.
I know, 16 bytes is just not enough!
The op codes are stored in bytes, so they're essentially an 8 bit opcode. Also, I might be adding instructions (eventually), so I want to leave a whole 8 bits for the instructions.
I'm not exactly sure what you mean here. Are you talking about changing what gets added to another number? :S