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

Subversion Repositories tv80

[/] [tv80/] [trunk/] [rtl/] [app_localcfg/] [behave1p_mem.v] - Blame information for rev 101

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

Line No. Rev Author Line
1 101 ghutchis
//----------------------------------------------------------------------
2
// Author: Guy Hutchison
3
//
4
// This block is uncopyrighted and released into the public domain.
5
//----------------------------------------------------------------------
6
 
7
module behave1p_mem
8
  #(parameter width=8,
9
    parameter depth=256,
10
    parameter addr_sz=8)  //log2(depth))
11
  (/*AUTOARG*/
12
  // Outputs
13
  d_out,
14
  // Inputs
15
  wr_en, rd_en, clk, d_in, addr
16
  );
17
  input        wr_en, rd_en, clk;
18
  input [width-1:0] d_in;
19
  input [addr_sz-1:0]     addr;
20
 
21
  output [width-1:0]     d_out;
22
 
23
  reg [addr_sz-1:0] r_addr;
24
 
25
  reg [width-1:0]            array[0:depth-1];
26
 
27
  always @(posedge clk)
28
    begin
29
      if (wr_en)
30
        begin
31
          array[addr] <= #1 d_in;
32
        end
33
      else if (rd_en)
34
        begin
35
          r_addr <= #1 addr;
36
        end
37
    end // always @ (posedge clk)
38
 
39
  assign d_out = array[r_addr];
40
 
41
  genvar g;
42
 
43
  generate
44
    for (g=0; g<depth; g=g+1)
45
      begin : breakout
46
        wire [width-1:0] brk;
47
 
48
        assign brk=array[g];
49
      end
50
  endgenerate
51
 
52
endmodule

powered by: WebSVN 2.1.0

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