~ruther/verilog-riscv-semestral-project

8f631f51a777c2aa139b677706608f2189c091a3 — Rutherther 1 year, 5 months ago 938d89a
refactor: move memory out of cpu

The cpu will have external memory,
that will allow for better testing
capabilities, and also makes more
sense.
1 files changed, 24 insertions(+), 18 deletions(-)

M src/cpu.sv
M src/cpu.sv => src/cpu.sv +24 -18
@@ 1,8 1,18 @@
import cpu_types::*;

module cpu(
  input clk,
  input rst_n
  input             clk,
  input             rst_n,

  // program memory
  input [31:0]      instruction,
  output reg [31:0] pc,

  // ram
  input [31:0]      memory_address,
  input [31:0]      memory_out,
  output reg [31:0] memory_write,
  output reg        memory_we
);
  parameter WIDTH = 32;



@@ 26,10 36,6 @@ module cpu(
  wire [1:0]  reg_write_src;
  wire        reg_we;

  wire [31:0] memory_address;
  wire [31:0] memory_out, memory_write;
  wire        memory_we;

  wire [31:0] immediate;

  wire        jump_instruction, jump_negate_zero;


@@ 135,16 141,16 @@ module cpu(
    .pc_next(pc_next[11:0])
  );

  program_memory program_memory_inst(
    .addr(pc[11:0]),
    .instruction(instruction)
  );

  ram memory_inst(
    .clk(clk),
    .a(memory_address),
    .we(memory_we),
    .wd(memory_write),
    .rd(memory_out)
  );
  // program_memory program_memory_inst(
  //   .addr(pc[11:0]),
  //   .instruction(instruction)
  // );

  // ram memory_inst(
  //   .clk(clk),
  //   .a(memory_address),
  //   .we(memory_we),
  //   .wd(memory_write),
  //   .rd(memory_out)
  // );
endmodule

Do not follow this link