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 2

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

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

powered by: WebSVN 2.1.0

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