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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 wfjm
-- $Id: ibdr_sdreg.vhd 427 2011-11-19 21:04:11Z mueller $
2 2 wfjm
--
3 13 wfjm
-- Copyright 2007-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:    ibdr_sdreg - syn
16
-- Description:    ibus dev(rem): Switch/Display register
17
--
18
-- Dependencies:   -
19
-- Test bench:     -
20
-- Target Devices: generic
21 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2, 10.1, 12.1, 13.1; ghdl 0.18-0.29
22 2 wfjm
--
23
-- Synthesized (xst):
24
-- Date         Rev  ise         Target      flop lutl lutm slic t peri
25 9 wfjm
-- 2010-10-17   333 12.1    M53d xc3s1000-4    34   40    0   30 s  4.0
26
-- 2009-07-11   232 10.1.03 K39  xc3s1000-4    32   39    0   29 s  2.5
27 2 wfjm
--
28
-- Revision History: 
29
-- Date         Rev Version  Comment
30 13 wfjm
-- 2011-11-18   427   1.2.1  now numeric_std clean
31 8 wfjm
-- 2010-10-17   333   1.2    use ibus V2 interface
32 2 wfjm
-- 2010-06-11   303   1.1    use IB_MREQ.racc instead of RRI_REQ
33
-- 2008-08-22   161   1.0.4  use iblib
34
-- 2008-04-18   136   1.0.3  use RESET. Switch/Display not cleared by console
35
--                           reset or reset instruction, only by cpu_reset
36
-- 2008-01-20   112   1.0.2  use BRESET
37
-- 2008-01-05   110   1.0.1  rename IB_MREQ(ena->req) SRES(sel->ack, hold->busy)
38
--                           reorganize code, all in state_type/proc_next
39
-- 2007-12-31   108   1.0    Initial version 
40
------------------------------------------------------------------------------
41
 
42
library ieee;
43
use ieee.std_logic_1164.all;
44 13 wfjm
use ieee.numeric_std.all;
45 2 wfjm
 
46
use work.slvtypes.all;
47
use work.iblib.all;
48
 
49
-- ----------------------------------------------------------------------------
50
entity ibdr_sdreg is                    -- ibus dev(rem): Switch/Display regs
51
                                        -- fixed address: 177570
52
  port (
53
    CLK : in slbit;                     -- clock
54
    RESET : in slbit;                   -- reset
55
    IB_MREQ : in ib_mreq_type;          -- ibus request
56
    IB_SRES : out ib_sres_type;         -- ibus response
57
    DISPREG : out slv16                 -- display register
58
  );
59
end ibdr_sdreg;
60
 
61
architecture syn of ibdr_sdreg is
62
 
63 13 wfjm
  constant ibaddr_sdreg : slv16 := slv(to_unsigned(8#177570#,16));
64 2 wfjm
 
65
  type regs_type is record              -- state registers
66 8 wfjm
    ibsel : slbit;                      -- ibus select
67 2 wfjm
    sreg : slv16;                       -- switch register
68
    dreg : slv16;                       -- display register
69
  end record regs_type;
70
 
71
  constant regs_init : regs_type := (
72 8 wfjm
    '0',                                -- ibsel
73
    (others=>'0'),                      -- sreg
74
    (others=>'0')                       -- dreg
75 2 wfjm
  );
76
 
77
  signal R_REGS : regs_type := regs_init;
78
  signal N_REGS : regs_type := regs_init;
79
 
80
begin
81
 
82
  proc_regs: process (CLK)
83
  begin
84 13 wfjm
    if rising_edge(CLK) then
85 2 wfjm
      if RESET = '1' then
86
        R_REGS <= regs_init;
87 8 wfjm
      else
88 2 wfjm
        R_REGS <= N_REGS;
89
      end if;
90
    end if;
91
  end process proc_regs;
92
 
93
  proc_next : process (R_REGS, IB_MREQ)
94
    variable r : regs_type := regs_init;
95
    variable n : regs_type := regs_init;
96
    variable idout : slv16 := (others=>'0');
97 8 wfjm
    variable ibreq : slbit := '0';
98 2 wfjm
  begin
99
 
100
    r := R_REGS;
101
    n := R_REGS;
102
 
103
    idout := (others=>'0');
104 8 wfjm
    ibreq := IB_MREQ.re or IB_MREQ.we;
105
 
106 2 wfjm
    -- ibus address decoder
107 8 wfjm
    n.ibsel := '0';
108
    if IB_MREQ.aval='1' and
109
       IB_MREQ.addr=ibaddr_sdreg(12 downto 1) then
110
      n.ibsel := '1';
111 2 wfjm
    end if;
112
 
113
    -- ibus output driver
114 8 wfjm
    if r.ibsel = '1' then
115 2 wfjm
      if IB_MREQ.racc = '0' then
116
        idout := r.sreg;             -- cpu will read switch register
117
      else
118
        idout := r.dreg;             -- rri will read display register
119
      end if;
120
    end if;
121
 
122
    -- ibus write transactions
123 8 wfjm
    if r.ibsel='1' and IB_MREQ.we='1' then
124 2 wfjm
      if IB_MREQ.racc = '0' then     -- cpu will write display register
125
        if IB_MREQ.be1 = '1' then
126
          n.dreg(ibf_byte1) := IB_MREQ.din(ibf_byte1);
127
        end if;
128
        if IB_MREQ.be0 = '1' then
129
          n.dreg(ibf_byte0) := IB_MREQ.din(ibf_byte0);
130
        end if;
131
      else                          -- rri will write switch register
132
        n.sreg := IB_MREQ.din;        -- byte write not supported
133
      end if;
134
    end if;
135
 
136
    N_REGS <= n;
137
 
138
    IB_SRES.dout <= idout;
139 8 wfjm
    IB_SRES.ack  <= r.ibsel and ibreq;
140 2 wfjm
    IB_SRES.busy <= '0';
141
 
142
    DISPREG <= r.dreg;
143
 
144
  end process proc_next;
145
 
146
 
147
end syn;

powered by: WebSVN 2.1.0

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