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

Subversion Repositories zet86

[/] [zet86/] [trunk/] [sim/] [memory.v] - Blame information for rev 55

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 42 zeus
 
2 2 zeus
`timescale 1ns/10ps
3
 
4
module memory (
5 35 zeus
    // Wishbone slave interface
6
    input         wb_clk_i,
7
    input         wb_rst_i,
8
    input  [15:0] wb_dat_i,
9
    output [15:0] wb_dat_o,
10
    input  [19:1] wb_adr_i,
11
    input         wb_we_i,
12
    input  [ 1:0] wb_sel_i,
13
    input         wb_stb_i,
14
    input         wb_cyc_i,
15
    output        wb_ack_o
16 2 zeus
  );
17
 
18
  // Registers and nets
19 35 zeus
  reg  [15:0] ram[2**19-1:0];
20 2 zeus
 
21 35 zeus
  wire       we;
22
  wire [7:0] bhw, blw;
23 2 zeus
 
24
  // Assignments
25 35 zeus
  assign wb_dat_o = ram[wb_adr_i];
26
  assign wb_ack_o = wb_stb_i;
27
  assign we       = wb_we_i & wb_stb_i & wb_cyc_i;
28 2 zeus
 
29 35 zeus
  assign bhw = wb_sel_i[1] ? wb_dat_i[15:8]
30
                           : ram[wb_adr_i][15:8];
31
  assign blw = wb_sel_i[0] ? wb_dat_i[7:0]
32
                           : ram[wb_adr_i][7:0];
33
 
34 2 zeus
  // Behaviour
35 35 zeus
  always @(posedge wb_clk_i)
36
    if (we) ram[wb_adr_i] <= { bhw, blw };
37 2 zeus
 
38 35 zeus
  initial $readmemh("/home/zeus/zet/sim/data.rtlrom",
39
                    ram, 19'h78000);
40 2 zeus
endmodule

powered by: WebSVN 2.1.0

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