Main »

Aligned Single Cycle Memory

Tasks

edit SideBar

Aligned Single-Cycle Memory Specification

Before building your cache, you should use this memory to update and test your processor's interface to properly handle unaligned accesses. Many processors (e.g., MIPS) are byte addressable, but require that all accesses be aligned to their natural size (i.e., byte loads and stores can access any individual byte, but word loads and stores must access aligned words). Since your processor only has word loads and stores, this is pretty simple (to support byte stores, the memory would need byte write enable signals; to support byte loads, either the memory or the processor needs a mux to select the right byte). Notice that the memory always returns aligned data even on a misaligned load.

The verilog source (memory2c_align.v) and synthesizable version (memory2c_align.syn.v) were included in the project tar.

Since your single-cycle design must fetch instructions as well as read or write data in the same cycle, you will want to use two instances of this memory -- one for data, and one for instructions.

                      +-------------+ 
data_in[15:0] >-------| |--------> data_out[15:0] addr[15:0] >-------| 65536 word | enable >-------| by 16 bit |--------> err wr >-------| memory | clk >-------| | rst >-------| | createdump >-------| | +-------------+

During each cycle, the "enable" and "wr" inputs determine what function the memory will perform. On a unaligned access err is set.

enablewrFunctiondata_outerr
0XNo operation00
10ReadM[addr]0
11WriteWrite data_in0
1XXif (data[0]) set1

Page last modified on February 18, 2016, visited 117 times

Edit - History - Print - Recent Changes (All) - Search