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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [sys_gen/] [tst_fx2loop/] [tst_fx2loop_hiomap.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 wfjm
-- $Id: tst_fx2loop_hiomap.vhd 453 2012-01-15 17:51:18Z mueller $
2
--
3
-- Copyright 2011-2012 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:    tst_fx2loop_hiomap - syn
16
-- Description:    default human I/O mapper 
17
--
18
-- Dependencies:   -
19
-- Test bench:     -
20
--
21
-- Target Devices: generic
22
-- Tool versions:  xst 13.3; ghdl 0.29
23
--
24
-- Revision History: 
25
-- Date         Rev Version  Comment
26
-- 2012-01-15   453   1.0.2  re-arrange DP,DSP usage
27
-- 2012-01-03   449   1.0.1  use new fx2ctl_moni layout
28
-- 2011-12-26   445   1.0    Initial version 
29
------------------------------------------------------------------------------
30
--
31
-- Usage of Switches, Buttons, LEDs:
32
--
33
--    BTN(3)    -- unused --
34
--       (2)    -- unused --
35
--       (1)    -- unused --
36
--       (0)    reset state  [!! decoded by top level design !!]
37
--
38
--    SWI(7:5)  select display 
39
--       (4)    -- unused --
40
--       (3)    throttle
41
--       (2)    tx2blast
42
--       (1:0)  mode  00  idle
43
--                    01  rxblast
44
--                    10  txblast
45
--                    11  loop
46
--
47
--    LED(7)    MONI.fifo_ep4
48
--       (6)    MONI.fifo_ep6
49
--       (5)    MONI.fifo_ep8
50
--       (4)    MONI.flag_ep4_empty
51
--       (3)    MONI.flag_ep4_almost
52
--       (2)    MONI.flag_ep6_full
53
--       (1)    MONI.flag_ep6_almost
54
--       (0)    rxsecnt > 0                     (sequence error)
55
--
56
--    DSP       data as selected by SWI(7:5)
57
--                000 -> rxsecnt
58
--                001 -> -- unused -- (display ffff)
59
--                010 -> rxcnt.l
60
--                011 -> rxcnt.h
61
--                100 -> txcnt.l
62
--                101 -> txcnt.h
63
--                110 -> tx2cnt.l
64
--                111 -> tx2cnt.h
65
--
66
--    DP(3)     FX2_TXBUSY      (shows tx back preasure)
67
--      (2)     FX2_MONI.slwr   (shows tx activity)
68
--      (1)     FX2_RXHOLD      (shows rx back preasure)
69
--      (0)     FX2_MONI.slrd   (shows rx activity)
70
--
71
 
72
library ieee;
73
use ieee.std_logic_1164.all;
74
use ieee.numeric_std.all;
75
 
76
use work.slvtypes.all;
77
use work.fx2lib.all;
78
use work.tst_fx2looplib.all;
79
 
80
-- ----------------------------------------------------------------------------
81
 
82
entity tst_fx2loop_hiomap is            -- default human I/O mapper 
83
  port (
84
    CLK : in slbit;                     -- clock
85
    RESET : in slbit;                   -- reset
86
    HIO_CNTL : out hio_cntl_type;       -- tester controls from hio
87
    HIO_STAT : in hio_stat_type;        -- tester status to diaplay by hio
88
    FX2_MONI : in fx2ctl_moni_type;     -- fx2ctl monitor to display by hio
89
    SWI : in slv8;                      -- switch settings
90
    BTN : in slv4;                      -- button settings
91
    LED : out slv8;                     -- led data
92
    DSP_DAT : out slv16;                -- display data
93
    DSP_DP : out slv4                   -- display decimal points
94
  );
95
end tst_fx2loop_hiomap;
96
 
97
architecture syn of tst_fx2loop_hiomap is
98
 
99
  type regs_type is record
100
    dspdat : slv16;                     -- display data
101
    dummy : slbit;                      -- <remove when 2nd signal added...>
102
  end record regs_type;
103
 
104
  constant regs_init : regs_type := (
105
    (others=>'0'),                      -- dspdat
106
    '0'
107
  );
108
 
109
  signal R_REGS : regs_type := regs_init;  -- state registers
110
  signal N_REGS : regs_type := regs_init;  -- next value state regs
111
 
112
begin
113
 
114
  proc_regs: process (CLK)
115
  begin
116
 
117
    if rising_edge(CLK) then
118
      if RESET = '1' then
119
        R_REGS <= regs_init;
120
      else
121
        R_REGS <= N_REGS;
122
      end if;
123
    end if;
124
 
125
  end process proc_regs;
126
 
127
  proc_next: process (R_REGS, HIO_STAT, FX2_MONI, SWI, BTN)
128
 
129
    variable r : regs_type := regs_init;
130
    variable n : regs_type := regs_init;
131
 
132
    variable icntl : hio_cntl_type := hio_cntl_init;
133
    variable iled  : slv8  := (others=>'0');
134
    variable idat  : slv16 := (others=>'0');
135
    variable idp   : slv4  := (others=>'0');
136
 
137
  begin
138
 
139
    r := R_REGS;
140
    n := R_REGS;
141
 
142
    icntl := hio_cntl_init;
143
    iled  := (others=>'0');
144
    idat  := (others=>'0');
145
    idp   := (others=>'0');
146
 
147
    -- setup tester controls
148
 
149
    icntl.mode := SWI(1 downto 0);
150
    icntl.tx2blast := SWI(2);
151
    icntl.throttle := SWI(3);
152
 
153
    -- setup leds
154
    iled(7) := FX2_MONI.fifo_ep4;
155
    iled(6) := FX2_MONI.fifo_ep6;
156
    iled(5) := FX2_MONI.fifo_ep8;
157
    iled(4) := FX2_MONI.flag_ep4_empty;
158
    iled(3) := FX2_MONI.flag_ep4_almost;
159
    iled(2) := FX2_MONI.flag_ep6_full;
160
    iled(1) := FX2_MONI.flag_ep6_almost;
161
    if unsigned(HIO_STAT.rxsecnt) > 0 then iled(0) := '1'; end if;
162
 
163
    -- setup display data
164
 
165
    case SWI(7 downto 5) is
166
      when "000" => idat := HIO_STAT.rxsecnt;
167
      when "001" => idat := (others=>'1');
168
      when "010" => idat := HIO_STAT.rxcnt(15 downto 0);
169
      when "011" => idat := HIO_STAT.rxcnt(31 downto 16);
170
      when "100" => idat := HIO_STAT.txcnt(15 downto 0);
171
      when "101" => idat := HIO_STAT.txcnt(31 downto 16);
172
      when "110" => idat := HIO_STAT.tx2cnt(15 downto 0);
173
      when "111" => idat := HIO_STAT.tx2cnt(31 downto 16);
174
      when others => null;
175
    end case;
176
    n.dspdat := idat;
177
 
178
    -- setup display decimal points
179
 
180
    idp(3) := HIO_STAT.txbusy;          -- tx back preasure
181
    idp(2) := FX2_MONI.slwr;            -- tx activity
182
    idp(1) := HIO_STAT.rxhold;          -- rx back preasure
183
    idp(0) := FX2_MONI.slrd;            -- rx activity
184
 
185
    N_REGS <= n;
186
 
187
    HIO_CNTL <= icntl;
188
    LED      <= iled;
189
    DSP_DAT  <= r.dspdat;
190
    DSP_DP   <= idp;
191
 
192
  end process proc_next;
193
 
194
end syn;

powered by: WebSVN 2.1.0

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