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

Subversion Repositories w11

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

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

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

powered by: WebSVN 2.1.0

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