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

Subversion Repositories zet86

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

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

Line No. Rev Author Line
1 2 zeus
`timescale 1ns/10ps
2
 
3
module memory (
4
    input         clk,
5
    input  [19:0] addr,
6
    input  [15:0] wr_data,
7
    output [15:0] rd_data,
8
    input         we,
9
    input         byte_m
10
  );
11
 
12
  // Registers and nets
13
  wire [19:0] addr1;
14
 
15
  reg [7:0] ram[2**20-1:0];
16
 
17
  // Assignments
18
  assign rd_data = byte_m ? { {8{ram[addr][7]}}, ram[addr]}
19
                  : {ram[addr1], ram[addr]};
20
  assign addr1   = addr + 20'd1;
21
 
22
  // Behaviour
23
  always @(posedge clk)
24 14 zeus
    if (we) if (byte_m) ram[addr] <= wr_data[7:0];
25
            else { ram[addr1], ram[addr] } <= wr_data;
26 2 zeus
 
27 22 zeus
  initial $readmemh("/home/zeus/zet/sim/11_shifts.rtlrom", ram, 20'hf0000);
28 2 zeus
endmodule

powered by: WebSVN 2.1.0

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