Decoder

A decoder is a logic circuit that receives bits and produces bits, where only one bit is set to one

That bit is “hot

We have the truth table given by

We can also have an enable signal (which means that the vector when enable is )

Larger decoder can be constructed from smaller decoders

Memory

Memory allows to store bits. There are a lot of different implementations of memory.

We can represent memory as a two dimensional array. Where

  • One memory element is at a row , and is called a data word (vector of bits)7

We call that index the address.

We typically store data in bytes () (8-bit vectors) Capacity is the amount of bytes it can store

We have units:

UnitBytes
Kilobyte
Megabyte
Gigabyte
Terabyte

Access protocols

We have multiple protocols for accessing memory.

We will consider a simple protocol:

  • Synchronous write (on clock posedge)
  • Asynchronous read

Array of 4x4 DFFs

In Verilog

1D Array of Registers;

We can declare an array of words of bits as:

reg [b-1:0] memory [w-1:0];

To allow for modules where we can modify the width of vectors dynamically, we can use the parameter keyword:

// Set the default parameter of WIDTH to 1
parameter WIDTH = 1;
 
// Which allows use to instantiate the module with different widths
modulename #(.WIDTH(8)) instancename (/* ... */);