w11 - vhd  0.72
W11 CPU core and support modules
 All Classes Namespaces Files Functions Variables
sys_tst_fx2loop_n3.vhd
Go to the documentation of this file.
1 -- $Id: sys_tst_fx2loop_n3.vhd 638 2015-01-25 22:01:38Z mueller $
2 --
3 -- Copyright 2012-2015 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: sys_tst_fx2loop_n3 - syn
16 -- Description: test of Cypress EZ-USB FX2 controller
17 --
18 -- Dependencies: vlib/xlib/s6_cmt_sfs
19 -- vlib/genlib/clkdivce
20 -- bpgen/sn_humanio
21 -- tst_fx2loop_hiomap
22 -- tst_fx2loop
23 -- bplib/fx2lib/fx2_2fifoctl_ic [sys_conf_fx2_type="ic2"]
24 -- bplib/fx2lib/fx2_3fifoctl_ic [sys_conf_fx2_type="ic3"]
25 -- bplib/nxcramlib/nx_cram_dummy
26 --
27 -- Test bench: -
28 --
29 -- Target Devices: generic
30 -- Tool versions: xst 13.3-14.7; ghdl 0.29-0.31
31 --
32 -- Synthesized (xst):
33 -- Date Rev ise Target flop lutl lutm slic t peri ctl/MHz
34 -- 2013-04-25 510 14.5 P58f xc6slx16-2 416 516 68 199 p 5.3 ic3/150
35 -- 2013-04-24 510 13.3 O76d xc6slx16-2 417 674 68 228 p 5.3 ic3/175
36 -- 2012-04-09 461 13.3 O76d xc6slx16-2 429 620 48 232 p 7.2 ic3/100
37 --
38 -- 2013-04-25 510 14.5 P58f xc6slx16-2 349 427 48 163 p 5.4 ic2/150
39 -- 2013-04-24 510 13.3 O76d xc6slx16-2 355 569 48 208 p 5.4 ic2/175
40 -- 2012-04-09 461 13.3 O76d xc6slx16-2 347 499 32 175 p 7.9 ic2/100
41 --
42 -- 2013-04-24 510 13.3 O76d xc6slx16-2 299 486 32 175 p FAIL as2/100
43 -- 2012-04-09 461 13.3 O76d xc6slx16-2 299 460 32 164 p FAIL as2/100
44 --
45 -- Revision History:
46 -- Date Rev Version Comment
47 -- 2013-10-06 538 1.1 pll support, use clksys_vcodivide ect
48 -- 2013-04-24 510 1.0.1 CLKDIV.CDUWIDTH now 8, support >127 sysclk
49 -- 2012-04-09 461 1.0 Initial version (derived from sys_tst_fx2loop_n2)
50 ------------------------------------------------------------------------------
51 
52 library ieee;
53 use ieee.std_logic_1164.all;
54 use ieee.numeric_std.all;
55 
56 use work.slvtypes.all;
57 use work.xlib.all;
58 use work.genlib.all;
59 use work.bpgenlib.all;
60 use work.tst_fx2looplib.all;
61 use work.fx2lib.all;
62 use work.nxcramlib.all;
63 use work.sys_conf.all;
64 
65 -- ----------------------------------------------------------------------------
66 
67 entity sys_tst_fx2loop_n3 is -- top level
68  -- implements nexys3_aif + fx2 pins
69  port (
70  I_CLK100 : in slbit; -- 100 MHz clock
71  I_RXD : in slbit; -- receive data (board view)
72  O_TXD : out slbit; -- transmit data (board view)
73  I_SWI : in slv8; -- n3 switches
74  I_BTN : in slv5; -- n3 buttons
75  O_LED : out slv8; -- n3 leds
76  O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low)
77  O_SEG_N : out slv8; -- 7 segment disp: segments (act.low)
78  O_MEM_CE_N : out slbit; -- cram: chip enable (act.low)
79  O_MEM_BE_N : out slv2; -- cram: byte enables (act.low)
80  O_MEM_WE_N : out slbit; -- cram: write enable (act.low)
81  O_MEM_OE_N : out slbit; -- cram: output enable (act.low)
82  O_MEM_ADV_N : out slbit; -- cram: address valid (act.low)
83  O_MEM_CLK : out slbit; -- cram: clock
84  O_MEM_CRE : out slbit; -- cram: command register enable
85  I_MEM_WAIT : in slbit; -- cram: mem wait
86  O_MEM_ADDR : out slv23; -- cram: address lines
87  IO_MEM_DATA : inout slv16; -- cram: data lines
88  O_PPCM_CE_N : out slbit; -- ppcm: ...
89  O_PPCM_RST_N : out slbit; -- ppcm: ...
90  I_FX2_IFCLK : in slbit; -- fx2: interface clock
91  O_FX2_FIFO : out slv2; -- fx2: fifo address
92  I_FX2_FLAG : in slv4; -- fx2: fifo flags
93  O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low)
94  O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low)
95  O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low)
96  O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low)
97  IO_FX2_DATA : inout slv8 -- fx2: data lines
98  );
99 end sys_tst_fx2loop_n3;
100 
101 architecture syn of sys_tst_fx2loop_n3 is
102 
103  signal CLK : slbit := '0';
104  signal RESET : slbit := '0';
105 
106  signal CE_USEC : slbit := '0';
107  signal CE_MSEC : slbit := '0';
108 
109  signal SWI : slv8 := (others=>'0');
110  signal BTN : slv5 := (others=>'0');
111  signal LED : slv8 := (others=>'0');
112  signal DSP_DAT : slv16 := (others=>'0');
113  signal DSP_DP : slv4 := (others=>'0');
114 
115  signal LED_MAP : slv8 := (others=>'0');
116 
117  signal HIO_CNTL : hio_cntl_type := hio_cntl_init;
118  signal HIO_STAT : hio_stat_type := hio_stat_init;
119 
120  signal FX2_RXDATA : slv8 := (others=>'0');
121  signal FX2_RXVAL : slbit := '0';
122  signal FX2_RXHOLD : slbit := '0';
123  signal FX2_RXAEMPTY : slbit := '0';
124  signal FX2_TXDATA : slv8 := (others=>'0');
125  signal FX2_TXENA : slbit := '0';
126  signal FX2_TXBUSY : slbit := '0';
127  signal FX2_TXAFULL : slbit := '0';
128  signal FX2_TX2DATA : slv8 := (others=>'0');
129  signal FX2_TX2ENA : slbit := '0';
130  signal FX2_TX2BUSY : slbit := '1';
131  signal FX2_TX2AFULL : slbit := '0';
132  signal FX2_MONI : fx2ctl_moni_type := fx2ctl_moni_init;
133 
134 begin
135 
136  assert (sys_conf_clksys mod 1000000) = 0
137  report "assert sys_conf_clksys on MHz grid"
138  severity failure;
139 
141  generic map (
142  VCO_DIVIDE => sys_conf_clksys_vcodivide ,
143  VCO_MULTIPLY => sys_conf_clksys_vcomultiply ,
144  OUT_DIVIDE => sys_conf_clksys_outdivide ,
145  CLKIN_PERIOD => 10.0,
146  CLKIN_JITTER => 0.01,
147  STARTUP_WAIT => false,
148  GEN_TYPE => sys_conf_clksys_gentype )
149  port map (
150  CLKIN => I_CLK100,
151  CLKFX => CLK,
152  LOCKED => open
153  );
154 
155  CLKDIV : clkdivce
156  generic map (
157  CDUWIDTH => 8, -- good for up to 255 MHz !
158  USECDIV => sys_conf_clksys_mhz ,
159  MSECDIV => 1000)
160  port map (
161  CLK => CLK,
162  CE_USEC => CE_USEC,
163  CE_MSEC => CE_MSEC
164  );
165 
166  HIO : sn_humanio
167  generic map (
168  BWIDTH => 5,
169  DEBOUNCE => sys_conf_hio_debounce )
170  port map (
171  CLK => CLK,
172  RESET => '0',
173  CE_MSEC => CE_MSEC,
174  SWI => SWI,
175  BTN => BTN,
176  LED => LED,
177  DSP_DAT => DSP_DAT,
178  DSP_DP => DSP_DP,
179  I_SWI => I_SWI,
180  I_BTN => I_BTN,
181  O_LED => O_LED,
182  O_ANO_N => O_ANO_N,
183  O_SEG_N => O_SEG_N
184  );
185 
186  RESET <= BTN(0); -- BTN(0) will reset tester !!
187 
189  port map (
190  CLK => CLK,
191  RESET => RESET,
192  HIO_CNTL => HIO_CNTL,
193  HIO_STAT => HIO_STAT,
194  FX2_MONI => FX2_MONI,
195  SWI => SWI,
196  BTN => BTN(3 downto 0),
197  LED => LED_MAP ,
198  DSP_DAT => DSP_DAT,
199  DSP_DP => DSP_DP
200  );
201 
204  begin
205 
206  if SWI(4) = '1' then
207  LED(7) <= '0';
208  LED(6) <= '0';
209  LED(5) <= FX2_TX2BUSY;
210  LED(4) <= FX2_TX2ENA;
211  LED(3) <= FX2_TXBUSY;
212  LED(2) <= FX2_TXENA;
213  LED(1) <= FX2_RXHOLD;
214  LED(0) <= FX2_RXVAL;
215  else
216  LED <= LED_MAP;
217  end if;
218 
219  end process proc_led;
220 
221 
222  TST : tst_fx2loop
223  port map (
224  CLK => CLK,
225  RESET => RESET,
226  CE_MSEC => CE_MSEC,
227  HIO_CNTL => HIO_CNTL,
228  HIO_STAT => HIO_STAT,
229  FX2_MONI => FX2_MONI,
230  RXDATA => FX2_RXDATA ,
231  RXVAL => FX2_RXVAL ,
232  RXHOLD => FX2_RXHOLD ,
233  TXDATA => FX2_TXDATA ,
234  TXENA => FX2_TXENA ,
235  TXBUSY => FX2_TXBUSY ,
236  TX2DATA => FX2_TX2DATA ,
237  TX2ENA => FX2_TX2ENA ,
238  TX2BUSY => FX2_TX2BUSY
239  );
240 
241  FX2_CNTL_IC : if sys_conf_fx2_type = "ic2" generate
243  generic map (
244  RXFAWIDTH => 5,
245  TXFAWIDTH => 5,
246  PETOWIDTH => sys_conf_fx2_petowidth,
247  CCWIDTH => sys_conf_fx2_ccwidth ,
248  RXAEMPTY_THRES => 1,
249  TXAFULL_THRES => 1)
250  port map (
251  CLK => CLK,
252  RESET => RESET,
253  RXDATA => FX2_RXDATA,
254  RXVAL => FX2_RXVAL,
255  RXHOLD => FX2_RXHOLD,
257  TXDATA => FX2_TXDATA,
258  TXENA => FX2_TXENA,
259  TXBUSY => FX2_TXBUSY,
260  TXAFULL => FX2_TXAFULL,
261  MONI => FX2_MONI,
270  );
271  end generate FX2_CNTL_IC;
272 
273  FX2_CNTL_IC3 : if sys_conf_fx2_type = "ic3" generate
275  generic map (
276  RXFAWIDTH => 5,
277  TXFAWIDTH => 5,
278  PETOWIDTH => sys_conf_fx2_petowidth,
279  CCWIDTH => sys_conf_fx2_ccwidth ,
280  RXAEMPTY_THRES => 1,
281  TXAFULL_THRES => 1,
282  TX2AFULL_THRES => 1)
283  port map (
284  CLK => CLK,
285  RESET => RESET,
286  RXDATA => FX2_RXDATA,
287  RXVAL => FX2_RXVAL,
288  RXHOLD => FX2_RXHOLD,
290  TXDATA => FX2_TXDATA,
291  TXENA => FX2_TXENA,
292  TXBUSY => FX2_TXBUSY,
293  TXAFULL => FX2_TXAFULL,
294  TX2DATA => FX2_TX2DATA,
295  TX2ENA => FX2_TX2ENA,
296  TX2BUSY => FX2_TX2BUSY,
298  MONI => FX2_MONI,
307  );
308  end generate FX2_CNTL_IC3;
309 
310  SRAM_PROT : nx_cram_dummy -- connect CRAM to protection dummy
311  port map (
312  O_MEM_CE_N => O_MEM_CE_N,
313  O_MEM_BE_N => O_MEM_BE_N,
314  O_MEM_WE_N => O_MEM_WE_N,
315  O_MEM_OE_N => O_MEM_OE_N,
316  O_MEM_ADV_N => O_MEM_ADV_N,
317  O_MEM_CLK => O_MEM_CLK,
318  O_MEM_CRE => O_MEM_CRE,
319  I_MEM_WAIT => I_MEM_WAIT,
320  O_MEM_ADDR => O_MEM_ADDR,
321  IO_MEM_DATA => IO_MEM_DATA
322  );
323 
324  O_PPCM_CE_N <= '1'; -- keep parallel PCM memory disabled
325  O_PPCM_RST_N <= '1'; --
326 
327  O_TXD <= I_RXD; -- loop-back in serial port...
328 
329 end syn;
330 
out TXENAslbit
Definition: tst_fx2loop.vhd:55
in FX2_MONIfx2ctl_moni_type
Definition: tst_fx2loop.vhd:50
CLKIN_JITTERreal :=0.01
CCWIDTHpositive :=5
slv4 :=( others =>'0' ) DSP_DP
out HIO_STAThio_stat_type
Definition: tst_fx2loop.vhd:49
CCWIDTHpositive :=5
Definition: xlib.vhd:40
DEBOUNCEboolean :=true
Definition: sn_humanio.vhd:63
TXFAWIDTHpositive :=5
in CLKslbit
Definition: tst_fx2loop.vhd:45
GEN_TYPEstring :="PLL"
slv16 :=( others =>'0' ) DSP_DAT
CLKIN_PERIODreal :=10.0
nx_cram_dummy sram_protsram_prot
in HIO_STAThio_stat_type
out O_FX2_SLWR_Nslbit
out CE_MSECslbit
Definition: clkdivce.vhd:44
slv8 :=( others =>'0' ) LED
slv8 :=( others =>'0' ) FX2_RXDATA
hio_cntl_type :=hio_cntl_init HIO_CNTL
TXAFULL_THRESnatural :=1
CDUWIDTHpositive :=6
Definition: clkdivce.vhd:38
out O_SEG_Nslv8
Definition: sn_humanio.vhd:77
TX2AFULL_THRESnatural :=1
out O_FX2_SLWR_Nslbit
in RXDATAslv8
Definition: tst_fx2loop.vhd:51
tst_fx2loop tsttst
hio_stat_type :=hio_stat_init HIO_STAT
RXFAWIDTHpositive :=5
out O_LEDslv (LWIDTH - 1 downto 0)
Definition: sn_humanio.vhd:75
out HIO_CNTLhio_cntl_type
RXFAWIDTHpositive :=5
TXAFULL_THRESnatural :=1
OUT_DIVIDEpositive :=1
slv8 :=( others =>'0' ) FX2_TX2DATA
out O_FX2_PKTEND_Nslbit
in DSP_DPslv ((2 ** DCWIDTH) - 1 downto 0)
Definition: sn_humanio.vhd:72
slv8 :=( others =>'0' ) LED_MAP
MSECDIVpositive :=1000
Definition: clkdivce.vhd:40
out SWIslv (SWIDTH - 1 downto 0)
Definition: sn_humanio.vhd:68
out O_FX2_PKTEND_Nslbit
out CE_USECslbit
Definition: clkdivce.vhd:43
out O_FX2_SLOE_Nslbit
in CE_MSECslbit
Definition: tst_fx2loop.vhd:47
in CLKslbit
Definition: sn_humanio.vhd:65
out O_FX2_SLRD_Nslbit
in RESETslbit
Definition: tst_fx2loop.vhd:46
in I_SWIslv (SWIDTH - 1 downto 0)
Definition: sn_humanio.vhd:73
fx2_2fifoctl_ic cntlcntl
out O_FX2_SLRD_Nslbit
PETOWIDTHpositive :=7
in TXBUSYslbit
Definition: tst_fx2loop.vhd:56
slv5 :=( others =>'0' ) BTN
PETOWIDTHpositive :=7
in RXVALslbit
Definition: tst_fx2loop.vhd:52
slv8 :=( others =>'0' ) SWI
in CLKINslbit
in TX2BUSYslbit
Definition: tst_fx2loop.vhd:59
out O_FX2_SLOE_Nslbit
in I_BTNslv (BWIDTH - 1 downto 0)
Definition: sn_humanio.vhd:74
BWIDTHpositive :=4
Definition: sn_humanio.vhd:60
clkdivce clkdivclkdiv
out MONIfx2ctl_moni_type
STARTUP_WAITboolean :=false
out TX2ENAslbit
Definition: tst_fx2loop.vhd:58
in CLKslbit
Definition: clkdivce.vhd:42
out RXHOLDslbit
Definition: tst_fx2loop.vhd:53
sn_humanio hiohio
in FX2_MONIfx2ctl_moni_type
out MONIfx2ctl_moni_type
inout IO_FX2_DATAslv8
RXAEMPTY_THRESnatural :=1
inout IO_FX2_DATAslv8
in DSP_DATslv (4 * (2 ** DCWIDTH) - 1 downto 0)
Definition: sn_humanio.vhd:71
out LOCKEDslbit
proc_ledSWI,LED_MAP,FX2_TX2BUSY,FX2_TX2ENA,FX2_TXBUSY,FX2_TXENA,FX2_RXHOLD,FX2_RXVAL
in HIO_CNTLhio_cntl_type
Definition: tst_fx2loop.vhd:48
VCO_MULTIPLYpositive :=1
in RESETslbit :='0'
in RESETslbit :='0'
in LEDslv (LWIDTH - 1 downto 0)
Definition: sn_humanio.vhd:70
VCO_DIVIDEpositive :=1
out BTNslv (BWIDTH - 1 downto 0)
Definition: sn_humanio.vhd:69
s6_cmt_sfs gen_clksysgen_clksys
fx2ctl_moni_type :=fx2ctl_moni_init FX2_MONI
out TXDATAslv8
Definition: tst_fx2loop.vhd:54
out CLKFXslbit
RXAEMPTY_THRESnatural :=1
slv8 :=( others =>'0' ) FX2_TXDATA
in RESETslbit :='0'
Definition: sn_humanio.vhd:66
in CE_MSECslbit
Definition: sn_humanio.vhd:67
TXFAWIDTHpositive :=5
out O_ANO_Nslv ((2 ** DCWIDTH) - 1 downto 0)
Definition: sn_humanio.vhd:76
USECDIVpositive :=50
Definition: clkdivce.vhd:39
tst_fx2loop_hiomap hiomaphiomap
out TX2DATAslv8
Definition: tst_fx2loop.vhd:57