Problem Description
Implement a 4x4 matrix memory module that supports both read and write operations. The matrix should store 8-bit values and allow access via row and column selectors.
Module Interface
- Inputs:
clk: Clock signal
reset: Reset signal (active high)
row_sel: 2-bit row selector
col_sel: 2-bit column selector
wr_en: Write enable signal
din: 8-bit data input
- Output:
Expected Behavior
- On reset: All matrix elements initialized to 0
- When wr_en = 1: Write din to matrix[row_sel][col_sel]
- When wr_en = 0: Read matrix[row_sel][col_sel] to dout