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