1
\$\begingroup\$

I have basically no experience in electrical engineering or hardware design, but as an experienced software engineer, I recently took an interest in designing my own CPU. I followed the instructions/excercises presented in the book "The Elements of Computing Systems / Nisan & Schocken", which suggests a RAM design similiar to this:

CHIP RAM8 {
    IN in[16], load, address[3];
    OUT out[16];

    PARTS:
    DMux8Way(in=load,sel=address,a=a1,b=b1,c=c1,d=d1,e=e1,f=f1,g=g1,h=h1);
    Register(in=in,load=a1,out=aout);
    Register(in=in,load=b1,out=bout);
    Register(in=in,load=c1,out=cout);
    Register(in=in,load=d1,out=dout);
    Register(in=in,load=e1,out=eout);
    Register(in=in,load=f1,out=fout);
    Register(in=in,load=g1,out=gout);
    Register(in=in,load=h1,out=hout);
    Mux8Way16(a=aout,b=bout,c=cout,d=dout,e=eout,f=fout,g=gout,h=hout,sel=address,out=out);
}

So there is one "address" bus, which determines which address to read from. Optionally in the same cycle the value of the "in" bus is written to that memory address if the "load" bit is set.

Now I tried to take a spin on the architecture suggested by the book, where I would like to read instructions and data from the RAM in just one cycle (the book proposes a seperate ROM for the instructions). I came up with this RAM design:

CHIP RAM8 {
    IN in[16], load, address1[3],address2[3];
    OUT out1[16], out2[16];

    PARTS:
    DMux8Way(in=load,sel=address1,a=a1,b=b1,c=c1,d=d1,e=e1,f=f1,g=g1,h=h1);
    Register(in=in,load=a1,out=aout);
    Register(in=in,load=b1,out=bout);
    Register(in=in,load=c1,out=cout);
    Register(in=in,load=d1,out=dout);
    Register(in=in,load=e1,out=eout);
    Register(in=in,load=f1,out=fout);
    Register(in=in,load=g1,out=gout);
    Register(in=in,load=h1,out=hout);
    Mux8Way16(a=aout,b=bout,c=cout,d=dout,e=eout,f=fout,g=gout,h=hout,sel=address1,out=out1);
    Mux8Way16(a=aout,b=bout,c=cout,d=dout,e=eout,f=fout,g=gout,h=hout,sel=address2,out=out2);
}

So the only difference is basically, that I have introduced a second address bus, so I can read two addresses in parallel at the same time by also introducing a second mux into the chip design.

Now I have several questions concerning this design:

  • To me it seems, that the introduction of another mux seems rather cheap to read two items of data from the RAM in only one cycle. Also the hardware design seems totally sound to me (as a total hardware design noob) and simulating the chip seems to proof the design. Am I missing a big mistake/disadvantage of the design? Are there electrical contraints to the design?
  • Is this kind of design relevant at all, when reads from a lower hierarchy memory take up several cycles anyway?
  • Is this kind of design (reading multiple data items in parallel from RAM) used in any sort of existing, production-ready chips?
  • If yes... what kind of chips?
  • If no... why?

When googling, the only thing I could come up with was the topic of "PRAM", which refers to "parallel machines", not "parallel memory". Also there seems to be "DDR/QDR RAM" which I don't quite get, since they are still using a single bus to read data (are they reading different items of data on rising/falling clock edges?). But I guess these kinds of RAMs are not really relevant in regards to my design question anyways, since they need multiple cycles to read data anyways, while my design is register based and is able to read randomly accessed memory in only one cycle!?

I would appreciate any kind of information/clarification on this topic :)

\$\endgroup\$
2
\$\begingroup\$

The term you want is "dual port RAM", and yes, they exist both as discrete components and as building blocks inside chips such as FPGAs. They are frequently used when it is necessary to pass data from one clock domain to another, and somewhat less frequently as cache storage, which is what you seem to be trying to do.

DDR/QDR (double data rate, and quad data rate, respectively) are something else: they are techniques for improving the bandwidth of the individual connections to a RAM chip.

You can effectively create a memory with two read ports by simply hooking together two normal single-port memories. Connect their write ports to the same source, and use their read ports independently. The contents will always be identical copies.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the quick response. "Dual Port RAM" seems indeed to be what i was wondering about. \$\endgroup\$ – Wolf Oct 17 '15 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.