OpenCores
URL https://opencores.org/ocsvn/zet86/zet86/trunk

Subversion Repositories zet86

[/] [zet86/] [trunk/] [sim/] [memory.v] - Diff between revs 42 and 49

Only display areas with differences | Details | Blame | View Log

Rev 42 Rev 49
 
 
`timescale 1ns/10ps
`timescale 1ns/10ps
 
 
module memory (
module memory (
    // Wishbone slave interface
    // Wishbone slave interface
    input         wb_clk_i,
    input         wb_clk_i,
    input         wb_rst_i,
    input         wb_rst_i,
    input  [15:0] wb_dat_i,
    input  [15:0] wb_dat_i,
    output [15:0] wb_dat_o,
    output [15:0] wb_dat_o,
    input  [19:1] wb_adr_i,
    input  [19:1] wb_adr_i,
    input         wb_we_i,
    input         wb_we_i,
    input  [ 1:0] wb_sel_i,
    input  [ 1:0] wb_sel_i,
    input         wb_stb_i,
    input         wb_stb_i,
    input         wb_cyc_i,
    input         wb_cyc_i,
    output        wb_ack_o
    output        wb_ack_o
  );
  );
 
 
  // Registers and nets
  // Registers and nets
  reg  [15:0] ram[2**19-1:0];
  reg  [15:0] ram[2**19-1:0];
 
 
  wire       we;
  wire       we;
  wire [7:0] bhw, blw;
  wire [7:0] bhw, blw;
 
 
  // Assignments
  // Assignments
  assign wb_dat_o = ram[wb_adr_i];
  assign wb_dat_o = ram[wb_adr_i];
  assign wb_ack_o = wb_stb_i;
  assign wb_ack_o = wb_stb_i;
  assign we       = wb_we_i & wb_stb_i & wb_cyc_i;
  assign we       = wb_we_i & wb_stb_i & wb_cyc_i;
 
 
  assign bhw = wb_sel_i[1] ? wb_dat_i[15:8]
  assign bhw = wb_sel_i[1] ? wb_dat_i[15:8]
                           : ram[wb_adr_i][15:8];
                           : ram[wb_adr_i][15:8];
  assign blw = wb_sel_i[0] ? wb_dat_i[7:0]
  assign blw = wb_sel_i[0] ? wb_dat_i[7:0]
                           : ram[wb_adr_i][7:0];
                           : ram[wb_adr_i][7:0];
 
 
  // Behaviour
  // Behaviour
  always @(posedge wb_clk_i)
  always @(posedge wb_clk_i)
    if (we) ram[wb_adr_i] <= { bhw, blw };
    if (we) ram[wb_adr_i] <= { bhw, blw };
 
 
  initial $readmemh("/home/zeus/zet/sim/data.rtlrom",
  initial $readmemh("/home/zeus/zet/sim/data.rtlrom",
                    ram, 19'h78000);
                    ram, 19'h78000);
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.