Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

My Journey with Memory in DLS - 1kB? No problemo :)

A topic by Neutrinos created Jan 22, 2023 Views: 1,406 Replies: 12
Viewing posts 1 to 8
(39 edits)

What I really wanted to do to try to impress this discussion board was figure out how to make a 1KB memory chip but I quickly realized it would either be utterly unfeasible or just take way too long.

A packaged chip, no. having 1KB of memory in the workspace? Maybe....... Probably not.

The next day....   I take it all back hold my bong....    (^^^Me being an idiot^^^)

The next NEXT day....   Alrighty, here's what I've come up with.... Man these colored wires and pins are a godsend!

     I've created a 4-byte memory chip in DLS that uses only 12 input pins and 8 output pins. Here's what it looks like!

Let's get one thing out of the way first; Mainly in the interest of keeping the chips as small as possible, but also to have a basic notation that still let's me organize them, I have made my own shorthand names for these chips. Sorry if they're dumb!

Now, since that is the case, I should at least explain what each chip is;

  • [Orange] (*White and brown wires, please?) It's a multiplexor with an additional bit-select pin, and 4 data-in pins, each paired with it's own data-out pin. They allow me to choose which 1-Byte register I want to send those 8 data-in bits to. There is one for each data-in bit.
  • [RYGB] - These are 1-Byte registers. They've been outlined with the color of the wires they're connected to.
  • [Magenta] - These are multiplexors with 4 inputs, all output on a single wire. There's one for each data-in signal, as well as the store signal.

As you can see in the visualization above, The chip is quite small, not much bigger than the 1-byte registers within, and boy, it sure can store four 8-bit numbers! (8 BCD values in the example.)

 So, why this design? Well, I'm hoping it's at least somewhat clever coming from someone who's quite inexperienced, since it seemed like the obvious path for me to take as far as keeping things parallel goes. Otherwise, moving data to-and-from the registers would become quite slow with the clock we have in the current version of DLS. (I do plan to make serial registers and share them here at some point, though, as it would drastically increase the storage I can squeeze out of DLS. 1kB would be a cakewalk..)

You may have noticed the two indigo, "BS1," and, "BS2,"  inputs in the corner. If I want to chain multiple of these registers together, they are going to be necessary. If I used a serial bus to direct data to these registers, they would be totally unnecessary, but even then it would be a good idea to keep them around I think.

With two bits, you can select 4 different bytes, and with just three, you can select 8 different bytes. Isn't that neat? With this design, for every doubling of the storage size, you only need one additional Byte-Select pin on the chip. In other words, the number of pins grows logarithmically with the number of Bytes. If I do build a 1kB memory chip, the number of input pins would be a mere 2% of the number of bytes the chip can store. [10 + log(#Bytes) =  #pins]  Isn't binary counting awesome?

Additionally, You don't necessarily need any more output pins than required to send 1 Byte of data. (1000 pins! |\{^o^}/|)

You might now be asking, "Well, Neutrino, just how big of a memory chip can you make with this method? Will you ever make it to 1kB?"

UhGood question! Wiring takes eons for my pea-brain to do. I'll let you know!

In any case, thanks for reading. Hope I did a good. :)

Cheers,

- Neutrino

(5 edits)

So, looks like I can make a basic computer by following this diagram. What do you say we give it a shot? I might need Ben's help with this one.

"Once you can add, you can multiply. And once you can multiply, you can do anything."

Being able to rotate long chips so they sit in the rectangular workspace like these buses are would be great. Personally I think the workspace itself is plenty large, and this alone would allow us to fit far more pins on our chips.

Ben Eater - 7-Segment Hex Decoder (YouTube)

Hey guys! Found this video showing how to build a hex decoder for our beloved 7-segment displays!

(3 edits)

I was curious to learn about error correction, so I hopped over to 3B1B's channel. I found an awesome video on an early type of single-error correction known as Hamming Codes. I think it's something I could manage to implement into a computer in DLS, and it would be fun to try! Again, isn't binary counting just the greatest? I might be a digital logic noob but I've got my sights set high :)

Hi Neutrinos. I can help you in this situation as I am designing 128 bits of memory currently, and hoping to make it easy to up it to 1kb of memory.

By memory I mean RAM

(1 edit)

I might have just done 4kb of storage

impressive! I'd love to see that!

(3 edits)

Hey, Angus! I decided to catch up with you! Have a look, yeah?


I've made an update to my registers using the new Bus lines. In short, it helped me greatly reduce the number of wires to be, well, wired!

I kept stacking and stacking using this design until, well, the simulator couldn't really take much more. I learned the hard way why you stopped at 4kB! :D

Let's start from the ground up, shall we? Here are all the registers I've built.


1 bit to 1kB!

Didn't take as long as I thought

Here is what is inside each one of these, from left to right.....


What a climb! As you can see, I got a little lazy with the wiring towards the end there.

This was also around the point where DLS's framerate began to give me flashbacks to Blighttown.

Because the simulator was running so slow, I couldn't be bothered to try and build 4kB, but I did set the chips down to conceptualize what it would look like. Not too much different, but I was beginning to run out of workspace, so I had to rearrange a few things;


If you ask me, 1kB is probably more storage than I'll ever need in DLS, so I'm happy with what I've made here.

Maybe when performance improvements are made I'll continue to stack this design.


These aren't too terribly different from the register in my original post; They still use binary counting to select which byte is being read from / written to, but there is one main thing I'd like to point out, and get an opinion on.

If you take a look at the yellow pin, you'll notice it's connected to two small MUXs. One MUX has a Not gate behind it. It's the one connected to the Orange Bus Buffer chips. By doing this, I've made it so you can only either read or write to the chips at any given time. Turning the yellow Store, or, "Write" pin turns off the connection to the output pins. I'm not sure if this will be useful, but for some reason it seemed like the logical thing to do. (see what I did there? :p) I can, of course, always change it if needed.

I've also considered making a version that uses a counter to select the bytes, like a stack pointer or something? I've made one that has a toggle for counting in reverse, and so it would work. It would drastically reduce the amount of input pins needed, as you would only need the Data pins, Write pin, Clock pin, and reverse-counting toggle pin, and counter reset pin. Unfortunately, since the current version doesn't allow 7-Segment Displays to be embedded into chips, there would be no way to visualize which Byte is selected, without re-introducing all of the pins we just tried to bypass by adding the counter in the first place.

You could build a chip to convert a binary number into the same number of clock pulses, I imagine this would best be done using a multiplier, as it would require less pins than just inputting the Byte number you want to select. Having the reset pin can act as a sort of workaround to visualizing the selected byte, as you can just reset the stack pointer to 0 before moving it again.

The downside to the whole stack pointer Idea is that you can no longer select a Byte by sending bits in parallel; it has to be done with a given number of clock pulses. This means the read / Write time goes from nearly instantaneous to being dependent on where in the register you are writing to, because of the time it takes for the stack pointer to move there. Perhaps this feature would be better served in a serialized register, Which I also plan to make sometime.

Here's a 16-bit counter I made that would work well for this;


This counter doesn't slow down the simulation at all, and it can already select over sixty-five times the amount of Bytes I've managed to fit in a register. Although, because of the current maximum clock speed, it takes several minutes to count all the way up.

Here's the base counter that I stacked up to make this one; I think it may need a modification or two.


Because of the issues I mentioned, I think using a SerDes setup (Serializer - Deserializer) would work better than a counter. They could even be used together; We'll get there in a later post, but I have ideas.


(Side note; Inside the 256 Byte chip, you'll notice a bug I encountered where, if you screw up the bus line placement by only setting down pins, they cannot be deleted. Or, at least, I haven't yet found a way to do so.)

Here's a short GIF showing how the registers work: (4-Byte Register)

Hey I`m sorry for tuning in so late to the discussion  but how did you manage to wirelessly transmit signals to the bus?

(1 edit) (+1)

Hey! So sorry for not seeing your response sooner!

It's just how the busses take inputs. You wire from the input pin to the pin on the bus line you want it to use, and it will make the wire disappear, with a red dot on the input pin to let you know it's hooked up!

Here's a link to this project's files so you can try the chips out for yourself! (Be careful, the big storage chips can be pretty laggy!)

https://drive.google.com/drive/folders/1izAIND0fSJdlHVHxr_yGPsGMboNPWQWl?usp=dri...

Hey Neutrinos. I did add a silver/white wire as shown in Sebastian's video. But i guess I need brown now, huh? I have updated DLS to have zoom and panning with the help of the community. In the future, I plan to add a 16x9 screen which isnt much, but a start, and then the ability to play sound through a speaker.