Simple RAM (First Post)

Discussion in 'General Electronics Chat' started by james88, Aug 7, 2013.

  1. james88

    Thread Starter New Member

    Aug 7, 2013
    Hi All,

    As this is my first post, I feel I should follow the correct etiquette and introduce myself.

    I won't bore you all too much. My names James, I'm now 25 years old. I'm trying to teach myself as much as possible about electronics (both analog and digital), however, I'm afraid I'm another noob!

    So, my first question is....

    I've recently been experimenting with NAND gates and putting together simple bits, finally making a byte. My problem is, is that to make anything larger than a few bytes will be a nightmare with time and money. So is it possible to purchase a very simple alternative? I'm talking KB's simple just so I can continue with simple digital computing?

    (I know this maybe a proper-noob like question, so apologies in advance).

  2. odinhg

    Active Member

    Jul 22, 2009
  3. Shagas

    Active Member

    May 13, 2013
    You could try simple JK flipflop Ic's . You can get 4 to an IC , thats 4 bits there and they should only be 30cents or so for each .

    How would someone go about using such an IC?
    With a MCU I presume?
  4. panic mode

    Senior Member

    Oct 10, 2011
    you could do yourself a favour and simply use platform that makes life easier (MCU, CPLD, FPGA...)
  5. WBahn


    Mar 31, 2012
    A lot of it depends on what you goal is. If you are trying to make things that do things, you go a very different route than if you are trying to make things to learn how things are made and how they work.

    If the latter is your goal, then I would recommend making a staged progression. Start with NAND gates. Or let's step back and start at an even more primitive level with transistors or even relays and make some of the primitive gates using them -- but only make a few and prove to yourself that you can actually make functioning gates that can be driven by and, in turn, drive other gates. After that, move to primitive gates as embodied by 40xx or 74xx series logic chips. Use those to make the next higher set of logic building blocks. First, make any primitive gates that you didn't make with the transistors or relays -- so if you didn't make an XOR gate that way, do it now with NAND gates or something else you did make. The idea is that at each level you are restricted to building blocks that you have actually implemented at some lower level. So now you move on to things like a 2:1 mux, a half adder, a full adder, a latch, a flip-flop, a 1-bit register and perhaps make some of them 4-bits wide or perhaps even 8. Now you step up a level and can use chips that perform these functions and build counters and ALUs and memory files. Now you can step up and build a simple processor. And so forth and so on.

    At some point in this process it would be reasonable to make the jump to using a microcontroller and/or an FPGA. The FPGA, in particular, will let you continue doing digital designs of increasingly complex systems without costing you any additional money (until you have to step up to a larger FPGA).

    One really good book that takes this approach (though admittedly in simulation/emulation) is The Elements of Computing Systems (a.k.a., Nand2Tetris). With that you will start with NAND gates (and DFFs, too) and from there build up not only the hardware (again, in emulation) but also write an assembler, a virtual machine, a compiler, and an operating system. The compiler is for an object-oriented language comparable to a leaned down Java. The OS library you write includes math functions, graphics, console character generation, dynamic memory allocation.

    When you are done you have a shockingly capable machine (given how utterly braindead the processor is) and you know how every last little bit of it works (except what happens on the other side of the memory bank that is used for memory-mapped I/O for the keyboard and monitor).
  6. WBahn


    Mar 31, 2012
    An MCU is certainly a reasonable way, but the interfaces on many SRAM chips is simple enough that implementing the controller in a CPLD or FPGA is pretty straightforward even if you are writing all of it yourself.
    Shagas likes this.
  7. MrChips


    Oct 2, 2009
    Going from a single NAND memory bit to 1KB memory is a stretch of the imagination and more.

    Even a 16-byte SRAM is not something one would want to build from scratch. There are single chips that will do that for you all the way up to 4Mb and more.

    You can build a one-bit memory using two NAND gates. Put that together and learn how it works.
    Next, build a D-type flip-flop, T-flip-flop, J-K flip-flop and clocked J-K flip-flop.

    Next, get flip-flop chips and learn how to cascade and use them as registers and counters.

    Beyond that, just get the available chip that gets the job done.
  8. james88

    Thread Starter New Member

    Aug 7, 2013
    Thanks everyone,

    Yes I should really have said what I was ultimately hoping to achieve. Sorry for that.

    But yes the goal really was to start small and start to build on each part as I go along. My aim really at the moment is creating something like a counter or simple adder etc.

    Thanks WBahn that book certainly sounds like what I am after, I will have to look into that.

    Thanks all!
  9. Brownout

    Well-Known Member

    Jan 10, 2012
    Before you jump into FPGA's CPLD's and microprocessors, there is alot you can do with low density logic IC's. By adding flip-flops to your design, you can implement simple state machines. One interesting exercise is a vending machine, where you toggle swithes that represent quarters, nickles and dimes. The state machine keeps track of the amount entered , and dispenses a 'product' (by that I mean it lights up an LED and gives 'change' (more LED's)

    If you want to process data, you can get some 4-bit or 8-bit registers integrated into IC's. You can go so far as to build a rudimentary processor.

    Once you've exhausted what you can do with chips, you can start working with FPGA's. You can choose to enter your designs with a schematic editor, but that is becomming rare. You'll quickly graduate to HDL's (Hardware Description Language) You can buy inexpensive Altera Cyclone development systems and use Altera's tools for free. Or you can buy inexpensive Spartan dev kits and use free Xilinx tools. One advantage of using Altera is you get access to thier suite of predesigned logic functions, including 'soft' processors, which you can use in your designs.

    When you get to that point, you are at the same level as I am, so you'll need to find a smarter person to help you after that :)
    james88 likes this.