tvm_vpi_mmap.v 1.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
// TVM mmap maps virtual DRAM into interface of SRAM.
// This allows create testcases that directly access DRAM.

// Read only memory map, one cycle read.
// Usage: create and pass instance to additional arguments of $tvm_session.
module tvm_vpi_read_mmap
  #(
    parameter DATA_WIDTH = 8,
    parameter ADDR_WIDTH = 8,
    parameter BASE_ADDR_WIDTH = 32
    )
   (
    input                       clk,
    input                       rst,
    // Read Ports
    input [ADDR_WIDTH-1:0]      addr, // Local offset in terms of number of units
    output [DATA_WIDTH-1:0]     data_out, // The data port for read
    // Configure port
    input [BASE_ADDR_WIDTH-1:0] mmap_addr // The base address of memory map.
    );
   reg [DATA_WIDTH-1:0]         reg_data;
   assign data_out = reg_data;
endmodule

// Write only memory map, one cycle write.
// Usage: create and pass instance to additional arguments of $tvm_session.
module tvm_vpi_write_mmap
  #(
    parameter DATA_WIDTH = 8,
    parameter ADDR_WIDTH = 8,
    parameter BASE_ADDR_WIDTH = 32
    )
   (
    input                       clk,
    input                       rst,
    // Write Ports
    input [ADDR_WIDTH-1:0]      addr, // Local offset in terms of number of units
    input [DATA_WIDTH-1:0]      data_in, // The data port for write
    input                       en, // The enable port for write
    // Configure port
    input [BASE_ADDR_WIDTH-1:0] mmap_addr // The base address of memap
    );
endmodule