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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [w11a/] [pdp11_bram.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 wfjm
-- $Id: pdp11_bram.vhd 427 2011-11-19 21:04:11Z mueller $
2 2 wfjm
--
3 13 wfjm
-- Copyright 2008-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 2 wfjm
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
-- 
14
------------------------------------------------------------------------------
15
-- Module Name:    pdp11_bram - syn
16
-- Description:    pdp11: BRAM based ext. memory dummy
17
--
18
-- Dependencies:   memlib/ram_2swsr_rfirst_gen
19
-- Test bench:     -
20
-- Target Devices: generic
21 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 13.1; ghdl 0.18-0.29
22 2 wfjm
-- Revision History: 
23
-- Date         Rev Version  Comment
24 13 wfjm
-- 2011-11-18   427   1.0.3  now numeric_std clean
25 2 wfjm
-- 2008-03-01   120   1.0.2  add addrzero constant to avoid XST errors
26
-- 2008-02-23   118   1.0.1  AWIDTH now a generic port
27
-- 2008-02-17   117   1.0    Initial version 
28
------------------------------------------------------------------------------
29
 
30
library ieee;
31
use ieee.std_logic_1164.all;
32 13 wfjm
use ieee.numeric_std.all;
33 2 wfjm
 
34
use work.slvtypes.all;
35
use work.memlib.all;
36
use work.pdp11.all;
37
 
38
entity pdp11_bram is                   -- cache
39
  generic (
40
    AWIDTH : positive := 14);           -- address width
41
  port (
42
    CLK : in slbit;                     -- clock
43
    GRESET : in slbit;                  -- global reset
44
    EM_MREQ : in em_mreq_type;          -- em request
45
    EM_SRES : out em_sres_type          -- em response
46
  );
47
end pdp11_bram;
48
 
49
 
50
architecture syn of pdp11_bram is
51
 
52
  type regs_type is record
53
    req_r : slbit;                      -- read request
54
    req_w : slbit;                      -- write request
55
    be : slv2;                          -- byte enables
56
    addr : slv(AWIDTH-1 downto 1);      -- address
57
  end record regs_type;
58
 
59
  constant addrzero : slv(AWIDTH-1 downto 1) := (others=>'0');
60
 
61
  constant regs_init : regs_type := (
62
    '0','0',                            -- req_r,w
63
    (others=>'0'),                      -- be
64
    addrzero                            -- addr
65
  );
66
 
67
  signal R_REGS : regs_type := regs_init;  -- state registers
68
  signal N_REGS : regs_type := regs_init;  -- next value state regs
69
 
70
  signal MEM_ENB : slbit := '0';
71
  signal MEM_WEA : slv2  := "00";
72
  signal MEM_DOA : slv16 := (others=>'0');
73
begin
74
 
75
  MEM_BYT0 : ram_2swsr_rfirst_gen
76
    generic map (
77
      AWIDTH => AWIDTH-1,
78
      DWIDTH =>  8)
79
    port map (
80
      CLKA  => CLK,
81
      CLKB  => CLK,
82
      ENA   => EM_MREQ.req,
83
      ENB   => MEM_ENB,
84
      WEA   => MEM_WEA(0),
85
      WEB   => R_REGS.be(0),
86
      ADDRA => EM_MREQ.addr(AWIDTH-1 downto 1),
87
      ADDRB => R_REGS.addr,
88
      DIA   => EM_MREQ.din(7 downto 0),
89
      DIB   => MEM_DOA(7 downto 0),
90
      DOA   => MEM_DOA(7 downto 0),
91
      DOB   => open
92
      );
93
 
94
  MEM_BYT1 : ram_2swsr_rfirst_gen
95
    generic map (
96
      AWIDTH => AWIDTH-1,
97
      DWIDTH =>  8)
98
    port map (
99
      CLKA  => CLK,
100
      CLKB  => CLK,
101
      ENA   => EM_MREQ.req,
102
      ENB   => MEM_ENB,
103
      WEA   => MEM_WEA(1),
104
      WEB   => R_REGS.be(1),
105
      ADDRA => EM_MREQ.addr(AWIDTH-1 downto 1),
106
      ADDRB => R_REGS.addr,
107
      DIA   => EM_MREQ.din(15 downto 8),
108
      DIB   => MEM_DOA(15 downto 8),
109
      DOA   => MEM_DOA(15 downto 8),
110
      DOB   => open
111
      );
112
 
113
  proc_regs: process (CLK)
114
  begin
115
 
116 13 wfjm
    if rising_edge(CLK) then
117 2 wfjm
      if GRESET = '1' then
118
        R_REGS <= regs_init;
119
      else
120
        R_REGS <= N_REGS;
121
      end if;
122
    end if;
123
 
124
  end process proc_regs;
125
 
126
  N_REGS.req_r  <= EM_MREQ.req and not EM_MREQ.we;
127
  N_REGS.req_w  <= EM_MREQ.req and EM_MREQ.we;
128
  N_REGS.be     <= EM_MREQ.be;
129
  N_REGS.addr   <= EM_MREQ.addr(N_REGS.addr'range);
130
 
131
  MEM_WEA(0) <= EM_MREQ.we and EM_MREQ.be(0);
132
  MEM_WEA(1) <= EM_MREQ.we and EM_MREQ.be(1);
133
  MEM_ENB    <= EM_MREQ.cancel and R_REGS.req_w;
134
 
135
  EM_SRES.ack_r <= R_REGS.req_r;
136
  EM_SRES.ack_w <= R_REGS.req_w;
137
  EM_SRES.dout  <= MEM_DOA;
138
 
139
end syn;

powered by: WebSVN 2.1.0

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