@@ -0,0 +1,52 | |||||
|
1 | ------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |||
|
3 | -- Copyright (C) 2017, Laboratory of Plasmas Physic - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | ------------------------------------------------------------------------------- | |||
|
19 | -- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ------------------------------------------------------------------------------- | |||
|
22 | LIBRARY ieee; | |||
|
23 | USE ieee.std_logic_1164.ALL; | |||
|
24 | USE ieee.numeric_std.ALL; | |||
|
25 | ||||
|
26 | ||||
|
27 | PACKAGE CY7C1061DV33_pkg IS | |||
|
28 | ||||
|
29 | COMPONENT CY7C1061DV33 IS | |||
|
30 | GENERIC | |||
|
31 | (ADDR_BITS : INTEGER := 20; | |||
|
32 | DATA_BITS : INTEGER := 16; | |||
|
33 | depth : INTEGER := 1048576; | |||
|
34 | ||||
|
35 | MEM_ARRAY_DEBUG : INTEGER := 32; | |||
|
36 | ||||
|
37 | TimingInfo : BOOLEAN := true; | |||
|
38 | TimingChecks : STD_LOGIC := '1' | |||
|
39 | ); | |||
|
40 | PORT ( | |||
|
41 | CE1_b : IN STD_LOGIC; -- Chip Enable CE1# | |||
|
42 | CE2 : IN STD_LOGIC; -- Chip Enable CE2 | |||
|
43 | WE_b : IN STD_LOGIC; -- Write Enable WE# | |||
|
44 | OE_b : IN STD_LOGIC; -- Output Enable OE# | |||
|
45 | BHE_b : IN STD_LOGIC; -- Byte Enable High BHE# | |||
|
46 | BLE_b : IN STD_LOGIC; -- Byte Enable Low BLE# | |||
|
47 | A : IN STD_LOGIC_VECTOR(addr_bits-1 DOWNTO 0); -- Address Inputs A | |||
|
48 | DQ : INOUT STD_LOGIC_VECTOR(DATA_BITS-1 DOWNTO 0) := (OTHERS => 'Z')-- Read/Write Data IO; | |||
|
49 | ); | |||
|
50 | END COMPONENT; | |||
|
51 | ||||
|
52 | END CY7C1061DV33_pkg; |
@@ -0,0 +1,70 | |||||
|
1 | --**************************************************************** | |||
|
2 | --** MODEL : package_utility ** | |||
|
3 | --** COMPANY : Cypress Semiconductor ** | |||
|
4 | --** REVISION: 1.0 Created new package utility model ** | |||
|
5 | --** ** | |||
|
6 | --**************************************************************** | |||
|
7 | Library ieee,work; | |||
|
8 | Use ieee.std_logic_1164.all; | |||
|
9 | Use IEEE.Std_Logic_Arith.all; | |||
|
10 | Use IEEE.std_logic_TextIO.all; | |||
|
11 | ||||
|
12 | Library Std; | |||
|
13 | Use STD.TextIO.all; | |||
|
14 | ||||
|
15 | Package package_utility is | |||
|
16 | ||||
|
17 | FUNCTION convert_string( S: in STRING) RETURN STD_LOGIC_VECTOR; | |||
|
18 | FUNCTION conv_integer1(S : STD_LOGIC_VECTOR) RETURN INTEGER; | |||
|
19 | ||||
|
20 | End; -- package package_utility | |||
|
21 | ||||
|
22 | Package body package_utility is | |||
|
23 | ||||
|
24 | ||||
|
25 | ------------------------------------------------------------------------------------------------ | |||
|
26 | --Converts string into std_logic_vector | |||
|
27 | ------------------------------------------------------------------------------------------------ | |||
|
28 | ||||
|
29 | FUNCTION convert_string(S: in STRING) RETURN STD_LOGIC_VECTOR IS | |||
|
30 | VARIABLE result : STD_LOGIC_VECTOR(S'RANGE); | |||
|
31 | BEGIN | |||
|
32 | FOR i IN S'RANGE LOOP | |||
|
33 | IF S(i) = '0' THEN | |||
|
34 | result(i) := '0'; | |||
|
35 | ELSIF S(i) = '1' THEN | |||
|
36 | result(i) := '1'; | |||
|
37 | ELSIF S(i) = 'X' THEN | |||
|
38 | result(i) := 'X'; | |||
|
39 | ELSE | |||
|
40 | result(i) := 'Z'; | |||
|
41 | END IF; | |||
|
42 | END LOOP; | |||
|
43 | RETURN result; | |||
|
44 | END convert_string; | |||
|
45 | ||||
|
46 | ------------------------------------------------------------------------------------------------ | |||
|
47 | --Converts std_logic_vector into integer | |||
|
48 | ------------------------------------------------------------------------------------------------ | |||
|
49 | ||||
|
50 | FUNCTION conv_integer1(S : STD_LOGIC_VECTOR) RETURN INTEGER IS | |||
|
51 | VARIABLE result : INTEGER := 0; | |||
|
52 | BEGIN | |||
|
53 | FOR i IN S'RANGE LOOP | |||
|
54 | IF S(i) = '1' THEN | |||
|
55 | result := result + (2**i); | |||
|
56 | ELSIF S(i) = '0' THEN | |||
|
57 | result := result; | |||
|
58 | ELSE | |||
|
59 | result := 0; | |||
|
60 | END IF; | |||
|
61 | END LOOP; | |||
|
62 | RETURN result; | |||
|
63 | END conv_integer1; | |||
|
64 | ||||
|
65 | ||||
|
66 | ||||
|
67 | ||||
|
68 | end package_utility; | |||
|
69 | ||||
|
70 |
@@ -1,164 +1,165 | |||||
1 | -------------------------------------------------------------------------------- |
|
1 | -------------------------------------------------------------------------------- | |
2 | -- Copyright 2007 Actel Corporation. All rights reserved. |
|
2 | -- Copyright 2007 Actel Corporation. All rights reserved. | |
3 |
|
3 | |||
4 | -- ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN |
|
4 | -- ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN | |
5 | -- ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED |
|
5 | -- ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED | |
6 | -- IN ADVANCE IN WRITING. |
|
6 | -- IN ADVANCE IN WRITING. | |
7 |
|
7 | |||
8 | -- Revision 3.0 April 30, 2007 : v3.0 CoreFFT Release |
|
8 | -- Revision 3.0 April 30, 2007 : v3.0 CoreFFT Release | |
9 | -- Package: fft_components.vhd |
|
9 | -- Package: fft_components.vhd | |
10 | -- Description: CoreFFT |
|
10 | -- Description: CoreFFT | |
11 | -- Core package |
|
11 | -- Core package | |
12 | -- Rev: 0.1 8/31/2005 12:54PM VD : Pre Production |
|
12 | -- Rev: 0.1 8/31/2005 12:54PM VD : Pre Production | |
13 | -- |
|
13 | -- | |
14 | -- |
|
14 | -- | |
15 | -------------------------------------------------------------------------------- |
|
15 | -------------------------------------------------------------------------------- | |
16 | library IEEE; |
|
16 | library IEEE; | |
17 | use IEEE.STD_LOGIC_1164.all; |
|
17 | use IEEE.STD_LOGIC_1164.all; | |
18 | USE IEEE.numeric_std.all; |
|
18 | USE IEEE.numeric_std.all; | |
19 | USE std.textio.all; |
|
19 | USE std.textio.all; | |
20 | USE IEEE.STD_LOGIC_TEXTIO.all; |
|
20 | USE IEEE.STD_LOGIC_TEXTIO.all; | |
21 |
|
21 | |||
22 | package FFT_COMPONENTS is |
|
22 | package FFT_COMPONENTS is | |
23 | CONSTANT gPTS : integer:=256; --Number of FFT points |
|
23 | CONSTANT gPTS : integer:=256; --Number of FFT points | |
24 | CONSTANT gLOGPTS : integer:=8; --Log2(PTS) |
|
24 | CONSTANT gLOGPTS : integer:=8; --Log2(PTS) | |
25 | CONSTANT gLOGLOGPTS : integer:=3; --Stage counter width |
|
25 | CONSTANT gLOGLOGPTS : integer:=3; --Stage counter width | |
26 | ------------------------------------------------- |
|
26 | ------------------------------------------------- | |
27 | CONSTANT gWSIZE : integer:=16; -- FFT bit resolution; length of a re or im sample |
|
27 | CONSTANT gWSIZE : integer:=16; -- FFT bit resolution; length of a re or im sample | |
28 | CONSTANT gTWIDTH : integer:=16; -- Twiddle, sin or cos bit resolution |
|
28 | CONSTANT gTWIDTH : integer:=16; -- Twiddle, sin or cos bit resolution | |
29 | CONSTANT gHALFPTS : integer:=gPTS/2; -- Num of FFT points (PTS) divided by 2 |
|
29 | CONSTANT gHALFPTS : integer:=gPTS/2; -- Num of FFT points (PTS) divided by 2 | |
30 | CONSTANT gDWIDTH : integer:=2*gWSIZE; -- width of a complex input word, |
|
30 | CONSTANT gDWIDTH : integer:=2*gWSIZE; -- width of a complex input word, | |
31 | CONSTANT gTDWIDTH : integer:=2*gTWIDTH; -- width of a complex twiddle factor |
|
31 | CONSTANT gTDWIDTH : integer:=2*gTWIDTH; -- width of a complex twiddle factor | |
32 | CONSTANT gRND_MODE : integer:=1; -- enable product rounding |
|
32 | CONSTANT gRND_MODE : integer:=1; -- enable product rounding | |
33 | CONSTANT gSCALE_MODE : integer:=0; -- scale mode |
|
33 | CONSTANT gSCALE_MODE : integer:=0; -- scale mode | |
34 | CONSTANT gInBuf_RWDLY : integer:=12; |
|
34 | CONSTANT gInBuf_RWDLY : integer:=12; | |
35 |
|
35 | |||
36 | function to_logic ( x : integer) return std_logic; |
|
36 | function to_logic ( x : integer) return std_logic; | |
37 | function to_logic ( x : boolean) return std_logic; |
|
37 | function to_logic ( x : boolean) return std_logic; | |
38 | FUNCTION to_integer( sig : std_logic_vector) return integer; |
|
38 | FUNCTION to_integer( sig : std_logic_vector) return integer; | |
39 | function to_integer( x : boolean) return integer; |
|
39 | function to_integer( x : boolean) return integer; | |
40 | function maskbar (barn, bar_enable,dma_reg_bar,dma_reg_loc : integer) return integer; |
|
40 | function maskbar (barn, bar_enable,dma_reg_bar,dma_reg_loc : integer) return integer; | |
41 | function anyfifo (bar0, bar1, bar2, bar3, bar4, bar5 : integer) return integer; |
|
41 | function anyfifo (bar0, bar1, bar2, bar3, bar4, bar5 : integer) return integer; | |
42 | FUNCTION reverse (x : std_logic_vector) RETURN bit_vector; |
|
42 | FUNCTION reverse (x :IN std_logic_vector) RETURN bit_vector; | |
43 | FUNCTION reverseStd(x : std_logic_vector) RETURN std_logic_vector; |
|
43 | ||
|
44 | FUNCTION reverseStd(x :IN std_logic_vector) RETURN std_logic_vector; | |||
44 |
|
45 | |||
45 | COMPONENT counter |
|
46 | COMPONENT counter | |
46 | GENERIC ( |
|
47 | GENERIC ( | |
47 | WIDTH : integer := 7; |
|
48 | WIDTH : integer := 7; | |
48 | TERMCOUNT : integer := 127 ); |
|
49 | TERMCOUNT : integer := 127 ); | |
49 | PORT ( |
|
50 | PORT ( | |
50 | clk, nGrst, rst, cntEn : IN std_logic; |
|
51 | clk, nGrst, rst, cntEn : IN std_logic; | |
51 | tc : OUT std_logic; |
|
52 | tc : OUT std_logic; | |
52 | Q : OUT std_logic_vector(WIDTH-1 DOWNTO 0)); |
|
53 | Q : OUT std_logic_vector(WIDTH-1 DOWNTO 0)); | |
53 | END COMPONENT; |
|
54 | END COMPONENT; | |
54 |
|
55 | |||
55 | COMPONENT bcounter |
|
56 | COMPONENT bcounter | |
56 | GENERIC ( |
|
57 | GENERIC ( | |
57 | WIDTH : integer := 7); |
|
58 | WIDTH : integer := 7); | |
58 | PORT ( |
|
59 | PORT ( | |
59 | clk, nGrst, rst, cntEn : IN std_logic; |
|
60 | clk, nGrst, rst, cntEn : IN std_logic; | |
60 | Q : OUT std_logic_vector(WIDTH-1 DOWNTO 0) ); |
|
61 | Q : OUT std_logic_vector(WIDTH-1 DOWNTO 0) ); | |
61 | END COMPONENT; |
|
62 | END COMPONENT; | |
62 |
|
63 | |||
63 | COMPONENT edgeDetect |
|
64 | COMPONENT edgeDetect | |
64 | GENERIC ( |
|
65 | GENERIC ( | |
65 | INPIPE :integer := 0; --if (INPIPE==1) insert input pipeline reg |
|
66 | INPIPE :integer := 0; --if (INPIPE==1) insert input pipeline reg | |
66 | FEDGE :integer := 0);--If FEDGE==1 detect falling edge, else-rising edge |
|
67 | FEDGE :integer := 0);--If FEDGE==1 detect falling edge, else-rising edge | |
67 | PORT ( |
|
68 | PORT ( | |
68 | clk, clkEn, edgeIn : IN std_logic; |
|
69 | clk, clkEn, edgeIn : IN std_logic; | |
69 | edgeOut : OUT std_logic); |
|
70 | edgeOut : OUT std_logic); | |
70 | END COMPONENT; |
|
71 | END COMPONENT; | |
71 |
|
72 | |||
72 | end FFT_COMPONENTS; |
|
73 | end FFT_COMPONENTS; | |
73 |
|
74 | |||
74 | package body FFT_COMPONENTS is |
|
75 | package body FFT_COMPONENTS is | |
75 |
|
76 | |||
76 | function to_logic ( x : integer) return std_logic is |
|
77 | function to_logic ( x : integer) return std_logic is | |
77 | variable y : std_logic; |
|
78 | variable y : std_logic; | |
78 | begin |
|
79 | begin | |
79 | if x = 0 then |
|
80 | if x = 0 then | |
80 | y := '0'; |
|
81 | y := '0'; | |
81 | else |
|
82 | else | |
82 | y := '1'; |
|
83 | y := '1'; | |
83 | end if; |
|
84 | end if; | |
84 | return y; |
|
85 | return y; | |
85 | end to_logic; |
|
86 | end to_logic; | |
86 |
|
87 | |||
87 | function to_logic( x : boolean) return std_logic is |
|
88 | function to_logic( x : boolean) return std_logic is | |
88 | variable y : std_logic; |
|
89 | variable y : std_logic; | |
89 | begin |
|
90 | begin | |
90 | if x then |
|
91 | if x then | |
91 | y := '1'; |
|
92 | y := '1'; | |
92 | else |
|
93 | else | |
93 | y := '0'; |
|
94 | y := '0'; | |
94 | end if; |
|
95 | end if; | |
95 | return(y); |
|
96 | return(y); | |
96 | end to_logic; |
|
97 | end to_logic; | |
97 |
|
98 | |||
98 | -- added 081805 |
|
99 | -- added 081805 | |
99 | function to_integer(sig : std_logic_vector) return integer is |
|
100 | function to_integer(sig : std_logic_vector) return integer is | |
100 | variable num : integer := 0; -- descending sig as integer |
|
101 | variable num : integer := 0; -- descending sig as integer | |
101 | begin |
|
102 | begin | |
102 | for i in sig'range loop |
|
103 | for i in sig'range loop | |
103 | if sig(i)='1' then |
|
104 | if sig(i)='1' then | |
104 | num := num*2+1; |
|
105 | num := num*2+1; | |
105 | else -- use anything other than '1' as '0' |
|
106 | else -- use anything other than '1' as '0' | |
106 | num := num*2; |
|
107 | num := num*2; | |
107 | end if; |
|
108 | end if; | |
108 | end loop; -- i |
|
109 | end loop; -- i | |
109 | return num; |
|
110 | return num; | |
110 | end function to_integer; |
|
111 | end function to_integer; | |
111 |
|
112 | |||
112 | function to_integer( x : boolean) return integer is |
|
113 | function to_integer( x : boolean) return integer is | |
113 | variable y : integer; |
|
114 | variable y : integer; | |
114 | begin |
|
115 | begin | |
115 | if x then |
|
116 | if x then | |
116 | y := 1; |
|
117 | y := 1; | |
117 | else |
|
118 | else | |
118 | y := 0; |
|
119 | y := 0; | |
119 | end if; |
|
120 | end if; | |
120 | return(y); |
|
121 | return(y); | |
121 | end to_integer; |
|
122 | end to_integer; | |
122 |
|
123 | |||
123 | function maskbar (barn, bar_enable,dma_reg_bar,dma_reg_loc : integer) return integer is |
|
124 | function maskbar (barn, bar_enable,dma_reg_bar,dma_reg_loc : integer) return integer is | |
124 | begin |
|
125 | begin | |
125 | if ( dma_reg_loc>= 2 and barn=dma_reg_bar) then |
|
126 | if ( dma_reg_loc>= 2 and barn=dma_reg_bar) then | |
126 | return(0); |
|
127 | return(0); | |
127 | else |
|
128 | else | |
128 | return(bar_enable); |
|
129 | return(bar_enable); | |
129 | end if; |
|
130 | end if; | |
130 | end maskbar; |
|
131 | end maskbar; | |
131 |
|
132 | |||
132 |
|
133 | |||
133 | function anyfifo ( bar0, bar1, bar2, bar3, bar4, bar5 : integer) return integer is |
|
134 | function anyfifo ( bar0, bar1, bar2, bar3, bar4, bar5 : integer) return integer is | |
134 | begin |
|
135 | begin | |
135 | if ( bar0=2 or bar1=2 or bar2=2 or bar3=2 or bar4=2 or bar5=2) then |
|
136 | if ( bar0=2 or bar1=2 or bar2=2 or bar3=2 or bar4=2 or bar5=2) then | |
136 | return(1); |
|
137 | return(1); | |
137 | else |
|
138 | else | |
138 | return(0); |
|
139 | return(0); | |
139 | end if; |
|
140 | end if; | |
140 | end anyfifo; |
|
141 | end anyfifo; | |
141 |
|
142 | |||
142 | FUNCTION reverse (x :IN std_logic_vector) |
|
143 | FUNCTION reverse (x :IN std_logic_vector) | |
143 | RETURN bit_vector IS |
|
144 | RETURN bit_vector IS | |
144 | VARIABLE i : integer; |
|
145 | VARIABLE i : integer; | |
145 | VARIABLE reverse : bit_vector(x'HIGH DOWNTO x'LOW); |
|
146 | VARIABLE reverse : bit_vector(x'HIGH DOWNTO x'LOW); | |
146 | BEGIN |
|
147 | BEGIN | |
147 | FOR i IN x'range LOOP |
|
148 | FOR i IN x'range LOOP | |
148 | reverse(i) := To_bit( x(x'HIGH - i)); |
|
149 | reverse(i) := To_bit( x(x'HIGH - i)); | |
149 | END LOOP; |
|
150 | END LOOP; | |
150 | RETURN(reverse); |
|
151 | RETURN(reverse); | |
151 | END FUNCTION reverse; |
|
152 | END FUNCTION reverse; | |
152 |
|
153 | |||
153 | FUNCTION reverseStd (x :IN std_logic_vector) |
|
154 | FUNCTION reverseStd (x :IN std_logic_vector) | |
154 | RETURN std_logic_vector IS |
|
155 | RETURN std_logic_vector IS | |
155 | VARIABLE i : integer; |
|
156 | VARIABLE i : integer; | |
156 | VARIABLE reverse : std_logic_vector(x'HIGH DOWNTO x'LOW); |
|
157 | VARIABLE reverse : std_logic_vector(x'HIGH DOWNTO x'LOW); | |
157 | BEGIN |
|
158 | BEGIN | |
158 | FOR i IN x'range LOOP |
|
159 | FOR i IN x'range LOOP | |
159 | reverse(i) := x(x'HIGH - i); |
|
160 | reverse(i) := x(x'HIGH - i); | |
160 | END LOOP; |
|
161 | END LOOP; | |
161 | RETURN(reverse); |
|
162 | RETURN(reverse); | |
162 | END FUNCTION reverseStd; |
|
163 | END FUNCTION reverseStd; | |
163 |
|
164 | |||
164 | end FFT_COMPONENTS; |
|
165 | end FFT_COMPONENTS; |
@@ -1,4 +1,4 | |||||
1 | package_utility.vhd |
|
1 | package_utility.vhd | |
2 | package_timing.vhd |
|
2 | package_timing.vhd | |
|
3 | CY7C1061DV33.vhd | |||
3 | CY7C1061DV33_pkg.vhd |
|
4 | CY7C1061DV33_pkg.vhd | |
4 | CY7C1061DV33.vhd |
|
@@ -1,84 +1,53 | |||||
1 | VHDLIB=../.. |
|
1 | VHDLIB=../.. | |
2 | SCRIPTSDIR=$(VHDLIB)/scripts/ |
|
2 | SCRIPTSDIR=$(VHDLIB)/scripts/ | |
3 | GRLIB := $(shell sh $(VHDLIB)/scripts/lpp_relpath.sh) |
|
3 | GRLIB := $(shell sh $(VHDLIB)/scripts/lpp_relpath.sh) | |
4 | TOP=testbench |
|
4 | TOP=testbench | |
5 |
BOARD=LFR- |
|
5 | BOARD=LFR-FM | |
6 | include $(VHDLIB)/boards/$(BOARD)/Makefile_RTAX.inc |
|
6 | include $(VHDLIB)/boards/$(BOARD)/Makefile_RTAX.inc | |
7 | DEVICE=$(PART)-$(PACKAGE)$(SPEED) |
|
7 | DEVICE=$(PART)-$(PACKAGE)$(SPEED) | |
8 | UCF= |
|
8 | UCF= | |
9 | QSF= |
|
9 | QSF= | |
10 | EFFORT=high |
|
10 | EFFORT=high | |
11 | XSTOPT= |
|
11 | XSTOPT= | |
12 | SYNPOPT= |
|
12 | SYNPOPT= | |
13 | VHDLSYNFILES= |
|
13 | VHDLSYNFILES= | |
14 |
VHDLSIMFILES= |
|
14 | VHDLSIMFILES= $(VHDLIB)/designs/SOLO_LFR_LFR-FM/LFR-FM.vhd tb.vhd | |
15 | SIMTOP=testbench |
|
15 | SIMTOP=testbench | |
16 | CLEAN=soft-clean |
|
16 | CLEAN=soft-clean | |
17 |
|
17 | |||
18 | TECHLIBS = axcelerator |
|
18 | TECHLIBS = axcelerator | |
19 |
|
19 | |||
20 | LIBSKIP = core1553bbc core1553brm core1553brt gr1553 corePCIF \ |
|
20 | ||
21 | tmtc openchip hynix ihp gleichmann micron usbhc opencores fmf ftlib gsi |
|
21 | LIBSKIP = tmtc openchip hynix cypress ihp usbhc fmf gsi spansion eth micron | |
22 |
|
22 | |||
23 |
DIRSKIP = |
|
23 | DIRSKIP = leon2 leon2ft crypto usb satcan ddr greth grusbhc \ | |
24 | pci grusbhc haps slink ascs can pwm greth coremp7 spi ac97 srmmu atf \ |
|
24 | leon4 leon4v0 l2cache iommu slink ascs pwm net spi can \ | |
25 | grlfpc \ |
|
|||
26 | ./dsp/lpp_fft_rtax \ |
|
|||
27 | ./amba_lcd_16x2_ctrlr \ |
|
25 | ./amba_lcd_16x2_ctrlr \ | |
28 | ./general_purpose/lpp_AMR \ |
|
26 | ./general_purpose/lpp_AMR \ | |
29 | ./general_purpose/lpp_balise \ |
|
27 | ./general_purpose/lpp_balise \ | |
30 | ./general_purpose/lpp_delay \ |
|
28 | ./general_purpose/lpp_delay \ | |
31 | ./lpp_bootloader \ |
|
29 | ./lpp_bootloader \ | |
32 | ./lfr_management \ |
|
|||
33 | ./lpp_sim/CY7C1061DV33 \ |
|
|||
34 | ./lpp_cna \ |
|
|||
35 | ./lpp_uart \ |
|
30 | ./lpp_uart \ | |
36 | ./lpp_usb \ |
|
31 | ./lpp_usb \ | |
37 | ./dsp/lpp_fft \ |
|
32 | ./lpp_debug_lfr \ | |
38 | ./lpp_leon3_soc \ |
|
33 | ./dsp/lpp_fft | |
39 | ./lpp_debug_lfr |
|
|||
40 |
|
34 | |||
41 | FILESKIP = i2cmst.vhd \ |
|
35 | FILESKIP = i2cmst.vhd \ | |
42 | APB_MULTI_DIODE.vhd \ |
|
36 | APB_MULTI_DIODE.vhd \ | |
43 | APB_MULTI_DIODE.vhd \ |
|
37 | APB_MULTI_DIODE.vhd \ | |
44 | Top_MatrixSpec.vhd \ |
|
38 | Top_MatrixSpec.vhd \ | |
45 | APB_FFT.vhd \ |
|
39 | APB_FFT.vhd \ | |
46 |
lpp_lfr_ |
|
40 | lpp_lfr_sim_pkg.vhd | |
47 | lpp_lfr_apbreg.vhd \ |
|
|||
48 | CoreFFT.vhd \ |
|
|||
49 | lpp_lfr_ms.vhd \ |
|
|||
50 | lpp_lfr_sim_pkg.vhd \ |
|
|||
51 | mtie_maps.vhd \ |
|
|||
52 | ftsrctrlc.vhd \ |
|
|||
53 | ftsdctrl.vhd \ |
|
|||
54 | ftsrctrl8.vhd \ |
|
|||
55 | ftmctrl.vhd \ |
|
|||
56 | ftsdctrl64.vhd \ |
|
|||
57 | ftahbram.vhd \ |
|
|||
58 | ftahbram2.vhd \ |
|
|||
59 | sramft.vhd \ |
|
|||
60 | nandfctrlx.vhd |
|
|||
61 |
|
41 | |||
62 | include $(GRLIB)/bin/Makefile |
|
42 | include $(GRLIB)/bin/Makefile | |
63 | include $(GRLIB)/software/leon3/Makefile |
|
43 | include $(GRLIB)/software/leon3/Makefile | |
64 |
|
||||
65 | ################## project specific targets ########################## |
|
44 | ################## project specific targets ########################## | |
66 | distclean:myclean |
|
45 | distclean:myclean | |
67 | vsim:cp_for_vsim |
|
|||
68 |
|
46 | |||
69 | myclean: |
|
47 | myclean: | |
70 | rm -f input.txt output_fx.txt *.log |
|
48 | rm -f input.txt output_fx.txt *.log | |
71 | rm -rf ./2016* |
|
49 | rm -rf ./2016* | |
72 |
|
50 | |||
73 | generate : |
|
51 | test: | ghdl ghdl-run archivate | |
74 | python ./generate.py |
|
|||
75 |
|
||||
76 | cp_for_vsim: generate |
|
|||
77 | cp ./input.txt simulation/ |
|
|||
78 |
|
||||
79 | archivate: |
|
|||
80 | xonsh ./archivate.xsh |
|
|||
81 |
|
||||
82 | test: | generate ghdl ghdl-run archivate |
|
|||
83 |
|
52 | |||
84 |
|
53 |
This diff has been collapsed as it changes many lines, (522 lines changed) Show them Hide them | |||||
@@ -1,254 +1,472 | |||||
1 |
|
1 | |||
2 | LIBRARY ieee; |
|
2 | LIBRARY ieee; | |
3 | USE ieee.std_logic_1164.ALL; |
|
3 | USE ieee.std_logic_1164.ALL; | |
4 | USE ieee.numeric_std.ALL; |
|
4 | USE ieee.numeric_std.ALL; | |
5 | USE IEEE.std_logic_signed.ALL; |
|
5 | USE IEEE.std_logic_signed.ALL; | |
6 | USE IEEE.MATH_real.ALL; |
|
6 | USE IEEE.MATH_real.ALL; | |
7 |
|
7 | |||
8 | LIBRARY techmap; |
|
8 | LIBRARY techmap; | |
9 | USE techmap.gencomp.ALL; |
|
9 | USE techmap.gencomp.ALL; | |
10 |
|
10 | |||
11 | LIBRARY std; |
|
11 | LIBRARY std; | |
12 | USE std.textio.ALL; |
|
12 | USE std.textio.ALL; | |
13 |
|
13 | |||
|
14 | library opencores; | |||
|
15 | use opencores.spwpkg.all; | |||
|
16 | use opencores.spwambapkg.all; | |||
|
17 | ||||
14 | LIBRARY lpp; |
|
18 | LIBRARY lpp; | |
15 | USE lpp.iir_filter.ALL; |
|
19 | USE lpp.iir_filter.ALL; | |
16 | USE lpp.lpp_ad_conv.ALL; |
|
20 | USE lpp.lpp_ad_conv.ALL; | |
17 | USE lpp.FILTERcfg.ALL; |
|
21 | USE lpp.FILTERcfg.ALL; | |
18 | USE lpp.lpp_lfr_filter_coeff.ALL; |
|
22 | USE lpp.lpp_lfr_filter_coeff.ALL; | |
19 | USE lpp.general_purpose.ALL; |
|
23 | USE lpp.general_purpose.ALL; | |
20 | USE lpp.data_type_pkg.ALL; |
|
24 | USE lpp.data_type_pkg.ALL; | |
21 | USE lpp.lpp_lfr_pkg.ALL; |
|
25 | USE lpp.lpp_lfr_pkg.ALL; | |
22 | USE lpp.general_purpose.ALL; |
|
26 | USE lpp.general_purpose.ALL; | |
23 | USE lpp.lpp_sim_pkg.ALL; |
|
27 | USE lpp.lpp_sim_pkg.ALL; | |
24 | USE lpp.lpp_waveform_pkg.ALL; |
|
28 | USE lpp.CY7C1061DV33_pkg.ALL; | |
25 |
|
29 | |||
26 | ENTITY testbench IS |
|
30 | ENTITY testbench IS | |
27 | GENERIC( |
|
31 | GENERIC( | |
28 | tech : INTEGER := 0; --axcel,0 |
|
32 | tech : INTEGER := 0; --axcel,0 | |
29 | Mem_use : INTEGER := use_CEL --use_RAM,use_CEL |
|
33 | Mem_use : INTEGER := use_CEL --use_RAM,use_CEL | |
30 | ); |
|
34 | ); | |
31 | END; |
|
35 | END; | |
32 |
|
36 | |||
33 | ARCHITECTURE behav OF testbench IS |
|
37 | ARCHITECTURE behav OF testbench IS | |
34 |
|
38 | |||
35 |
|
||||
36 | COMPONENT LFR_EQM IS |
|
|||
37 | GENERIC ( |
|
|||
38 | Mem_use : INTEGER := use_RAM; |
|
|||
39 | USE_BOOTLOADER : INTEGER := 0; |
|
|||
40 | USE_ADCDRIVER : INTEGER := 1; |
|
|||
41 | tech : INTEGER := inferred; |
|
|||
42 | tech_leon : INTEGER := inferred; |
|
|||
43 | DEBUG_FORCE_DATA_DMA : INTEGER := 0; |
|
|||
44 | USE_DEBUG_VECTOR : INTEGER := 0 |
|
|||
45 | ); |
|
|||
46 |
|
||||
47 | PORT ( |
|
|||
48 | clk50MHz : IN STD_ULOGIC; |
|
|||
49 | clk49_152MHz : IN STD_ULOGIC; |
|
|||
50 | reset : IN STD_ULOGIC; |
|
|||
51 |
|
||||
52 | TAG : INOUT STD_LOGIC_VECTOR(9 DOWNTO 1); |
|
|||
53 |
|
||||
54 | address : OUT STD_LOGIC_VECTOR(18 DOWNTO 0); |
|
|||
55 | data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
|||
56 |
|
||||
57 | nSRAM_MBE : INOUT STD_LOGIC; -- new |
|
|||
58 | nSRAM_E1 : OUT STD_LOGIC; -- new |
|
|||
59 | nSRAM_E2 : OUT STD_LOGIC; -- new |
|
|||
60 | -- nSRAM_SCRUB : OUT STD_LOGIC; -- new |
|
|||
61 | nSRAM_W : OUT STD_LOGIC; -- new |
|
|||
62 | nSRAM_G : OUT STD_LOGIC; -- new |
|
|||
63 | nSRAM_BUSY : IN STD_LOGIC; -- new |
|
|||
64 | -- SPW -------------------------------------------------------------------- |
|
|||
65 | spw1_en : OUT STD_LOGIC; -- new |
|
|||
66 | spw1_din : IN STD_LOGIC; |
|
|||
67 | spw1_sin : IN STD_LOGIC; |
|
|||
68 | spw1_dout : OUT STD_LOGIC; |
|
|||
69 | spw1_sout : OUT STD_LOGIC; |
|
|||
70 | spw2_en : OUT STD_LOGIC; -- new |
|
|||
71 | spw2_din : IN STD_LOGIC; |
|
|||
72 | spw2_sin : IN STD_LOGIC; |
|
|||
73 | spw2_dout : OUT STD_LOGIC; |
|
|||
74 | spw2_sout : OUT STD_LOGIC; |
|
|||
75 | -- ADC -------------------------------------------------------------------- |
|
|||
76 | bias_fail_sw : OUT STD_LOGIC; |
|
|||
77 | ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0); |
|
|||
78 | ADC_smpclk : OUT STD_LOGIC; |
|
|||
79 | ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0); |
|
|||
80 | -- DAC -------------------------------------------------------------------- |
|
|||
81 | DAC_SDO : OUT STD_LOGIC; |
|
|||
82 | DAC_SCK : OUT STD_LOGIC; |
|
|||
83 | DAC_SYNC : OUT STD_LOGIC; |
|
|||
84 | DAC_CAL_EN : OUT STD_LOGIC; |
|
|||
85 | -- HK --------------------------------------------------------------------- |
|
|||
86 | HK_smpclk : OUT STD_LOGIC; |
|
|||
87 | ADC_OEB_bar_HK : OUT STD_LOGIC; |
|
|||
88 | HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0) |
|
|||
89 | ); |
|
|||
90 |
|
||||
91 | END LFR_EQM; |
|
|||
92 |
|
||||
93 |
|
||||
94 | SIGNAL TSTAMP : INTEGER := 0; |
|
39 | SIGNAL TSTAMP : INTEGER := 0; | |
95 | SIGNAL clk : STD_LOGIC := '0'; |
|
40 | SIGNAL clk : STD_LOGIC := '0'; | |
96 |
SIGNAL clk |
|
41 | SIGNAL clk49_152MHz : STD_LOGIC := '0'; | |
97 | SIGNAL clk_24576Hz_r : STD_LOGIC := '0'; |
|
42 | SIGNAL rstn,rst : STD_LOGIC; | |
98 | SIGNAL rstn : STD_LOGIC; |
|
|||
99 |
|
||||
100 | SIGNAL signal_gen : sample_vector(0 to ChanelCount-1,17 downto 0); |
|
|||
101 | SIGNAL sample_fx_wdata : Samples(ChanelCount-1 DOWNTO 0); |
|
|||
102 | SIGNAL signal_rec : sample_vector(0 to ChanelCount-1,15 downto 0); |
|
|||
103 |
|
43 | |||
104 | SIGNAL end_of_simu : STD_LOGIC := '0'; |
|
44 | SIGNAL end_of_simu : STD_LOGIC := '0'; | |
105 |
|
45 | |||
106 | CONSTANT half_samplig_period : time := 20345052 ps; --INTEGER( REAL(1000**4) / REAL(2.0*24576.0)) * 1 ps; |
|
46 | ----------------------------------------------------------------------------- | |
|
47 | -- LFR TOP WRAPPER SIGNALS | |||
|
48 | ----------------------------------------------------------------------------- | |||
|
49 | SIGNAL address : STD_LOGIC_VECTOR(18 DOWNTO 0); | |||
|
50 | SIGNAL data : STD_LOGIC_VECTOR(31 DOWNTO 0); | |||
|
51 | ||||
|
52 | SIGNAL nSRAM_MBE : STD_LOGIC; -- new | |||
|
53 | SIGNAL nSRAM_E1 : STD_LOGIC; -- new | |||
|
54 | SIGNAL nSRAM_E2 : STD_LOGIC; -- new | |||
|
55 | -- nSRAM_SCRUB : OUT STD_LOGIC; -- new | |||
|
56 | SIGNAL nSRAM_W : STD_LOGIC; -- new | |||
|
57 | SIGNAL nSRAM_G : STD_LOGIC; -- new | |||
|
58 | SIGNAL nSRAM_BUSY : STD_LOGIC; -- new | |||
|
59 | -- SPW -------------------------------------------------------------------- | |||
|
60 | SIGNAL spw1_en : STD_LOGIC; -- new | |||
|
61 | SIGNAL spw1_din : STD_LOGIC; | |||
|
62 | SIGNAL spw1_sin : STD_LOGIC; | |||
|
63 | SIGNAL spw1_dout : STD_LOGIC; | |||
|
64 | SIGNAL spw1_sout : STD_LOGIC; | |||
|
65 | SIGNAL spw2_en : STD_LOGIC; -- new | |||
|
66 | SIGNAL spw2_din : STD_LOGIC; | |||
|
67 | SIGNAL spw2_sin : STD_LOGIC; | |||
|
68 | SIGNAL spw2_dout : STD_LOGIC; | |||
|
69 | SIGNAL spw2_sout : STD_LOGIC; | |||
|
70 | -- ADC -------------------------------------------------------------------- | |||
|
71 | SIGNAL bias_fail_sw : STD_LOGIC; | |||
|
72 | SIGNAL ADC_OEB_bar_CH : STD_LOGIC_VECTOR(7 DOWNTO 0); | |||
|
73 | SIGNAL ADC_smpclk : STD_LOGIC; | |||
|
74 | SIGNAL ADC_data : STD_LOGIC_VECTOR(13 DOWNTO 0); | |||
|
75 | -- DAC -------------------------------------------------------------------- | |||
|
76 | SIGNAL DAC_SDO : STD_LOGIC; | |||
|
77 | SIGNAL DAC_SCK : STD_LOGIC; | |||
|
78 | SIGNAL DAC_SYNC : STD_LOGIC; | |||
|
79 | SIGNAL DAC_CAL_EN : STD_LOGIC; | |||
|
80 | -- HK --------------------------------------------------------------------- | |||
|
81 | SIGNAL HK_smpclk : STD_LOGIC; | |||
|
82 | SIGNAL ADC_OEB_bar_HK : STD_LOGIC; | |||
|
83 | SIGNAL HK_SEL : STD_LOGIC_VECTOR(1 DOWNTO 0); | |||
|
84 | ||||
|
85 | SIGNAL nSRAM_CE : STD_LOGIC; | |||
|
86 | ||||
|
87 | ||||
|
88 | ||||
|
89 | ||||
|
90 | SIGNAL autostart: std_logic := '1'; | |||
|
91 | ||||
|
92 | -- Enables link start once the Ready state is reached. | |||
|
93 | -- Without autostart or linkstart, the link remains in state Ready. | |||
|
94 | SIGNAL linkstart: std_logic :='1'; | |||
|
95 | ||||
|
96 | -- Do not start link (overrides linkstart and autostart) and/or | |||
|
97 | -- disconnect a running link. | |||
|
98 | SIGNAL linkdis: std_logic := '0'; | |||
|
99 | ||||
|
100 | -- Control bits of the TimeCode to be sent. Must be valid while tick_in is high. | |||
|
101 | SIGNAL ctrl_in: std_logic_vector(1 downto 0) :=(others => '0'); | |||
|
102 | ||||
|
103 | -- Counter value of the TimeCode to be sent. Must be valid while tick_in is high. | |||
|
104 | SIGNAL time_in: std_logic_vector(5 downto 0):=(others => '0'); | |||
|
105 | ||||
|
106 | -- Pulled high by the application to write an N-Char to the transmit | |||
|
107 | -- queue. If "txwrite" and "txrdy" are both high on the rising edge | |||
|
108 | -- of "clk", a character is added to the transmit queue. | |||
|
109 | -- This signal has no effect if "txrdy" is low. | |||
|
110 | SIGNAL txwrite: std_logic := '0'; | |||
|
111 | ||||
|
112 | -- Control flag to be sent with the next N_Char. | |||
|
113 | -- Must be valid while txwrite is high. | |||
|
114 | SIGNAL txflag: std_logic :='0'; | |||
|
115 | ||||
|
116 | -- Byte to be sent, or "00000000" for EOP or "00000001" for EEP. | |||
|
117 | -- Must be valid while txwrite is high. | |||
|
118 | SIGNAL txdata: std_logic_vector(7 downto 0):=(others => '0'); | |||
|
119 | ||||
|
120 | -- High if the entity is ready to accept an N-Char for transmission. | |||
|
121 | SIGNAL txrdy: std_logic; | |||
|
122 | ||||
|
123 | -- High if the transmission queue is at least half full. | |||
|
124 | SIGNAL txhalff: std_logic; | |||
|
125 | ||||
|
126 | -- High for one clock cycle if a TimeCode was just received. | |||
|
127 | SIGNAL tick_out: std_logic; | |||
|
128 | ||||
|
129 | -- Control bits of the last received TimeCode. | |||
|
130 | SIGNAL ctrl_out: std_logic_vector(1 downto 0); | |||
|
131 | ||||
|
132 | -- Counter value of the last received TimeCode. | |||
|
133 | SIGNAL time_out: std_logic_vector(5 downto 0); | |||
|
134 | ||||
|
135 | -- High if "rxflag" and "rxdata" contain valid data. | |||
|
136 | -- This signal is high unless the receive FIFO is empty. | |||
|
137 | SIGNAL rxvalid: std_logic; | |||
|
138 | ||||
|
139 | -- High if the receive FIFO is at least half full. | |||
|
140 | SIGNAL rxhalff: std_logic; | |||
|
141 | ||||
|
142 | -- High if the received character is EOP or EEP; low if the received | |||
|
143 | -- character is a data byte. Valid if "rxvalid" is high. | |||
|
144 | SIGNAL rxflag: std_logic; | |||
|
145 | ||||
|
146 | -- Received byte, or "00000000" for EOP or "00000001" for EEP. | |||
|
147 | -- Valid if "rxvalid" is high. | |||
|
148 | SIGNAL rxdata: std_logic_vector(7 downto 0); | |||
|
149 | ||||
|
150 | -- Pulled high by the application to accept a received character. | |||
|
151 | -- If "rxvalid" and "rxread" are both high on the rising edge of "clk", | |||
|
152 | -- a character is removed from the receive FIFO and "rxvalid", "rxflag" | |||
|
153 | -- and "rxdata" are updated. | |||
|
154 | -- This signal has no effect if "rxvalid" is low. | |||
|
155 | SIGNAL rxread: std_logic:='0'; | |||
|
156 | ||||
|
157 | -- High if the link state machine is currently in the Started state. | |||
|
158 | SIGNAL started: std_logic; | |||
|
159 | ||||
|
160 | -- High if the link state machine is currently in the Connecting state. | |||
|
161 | SIGNAL connecting: std_logic; | |||
|
162 | ||||
|
163 | -- High if the link state machine is currently in the Run state, indicating | |||
|
164 | -- that the link is fully operational. If none of started, connecting or running | |||
|
165 | -- is high, the link is in an initial state and the transmitter is not yet enabled. | |||
|
166 | SIGNAL running: std_logic; | |||
|
167 | ||||
|
168 | -- Disconnect detected in state Run. Triggers a reset and reconnect of the link. | |||
|
169 | -- This indication is auto-clearing. | |||
|
170 | SIGNAL errdisc: std_logic; | |||
|
171 | ||||
|
172 | -- Parity error detected in state Run. Triggers a reset and reconnect of the link. | |||
|
173 | -- This indication is auto-clearing. | |||
|
174 | SIGNAL errpar: std_logic; | |||
|
175 | ||||
|
176 | -- Invalid escape sequence detected in state Run. Triggers a reset and reconnect of | |||
|
177 | -- the link. This indication is auto-clearing. | |||
|
178 | SIGNAL erresc: std_logic; | |||
|
179 | ||||
|
180 | -- Credit error detected. Triggers a reset and reconnect of the link. | |||
|
181 | -- This indication is auto-clearing. | |||
|
182 | SIGNAL errcred: std_logic; | |||
|
183 | ||||
107 |
|
184 | |||
108 | BEGIN |
|
185 | BEGIN | |
109 |
|
186 | |||
110 | ----------------------------------------------------------------------------- |
|
187 | ----------------------------------------------------------------------------- | |
111 | -- CLOCK and RESET |
|
188 | -- CLOCK and RESET | |
112 | ----------------------------------------------------------------------------- |
|
189 | ----------------------------------------------------------------------------- | |
113 | PROCESS |
|
190 | PROCESS | |
114 | BEGIN -- PROCESS |
|
191 | BEGIN -- PROCESS | |
115 | WAIT UNTIL clk = '1'; |
|
192 | WAIT UNTIL clk = '1'; | |
116 | rstn <= '0'; |
|
193 | rstn <= '0'; | |
|
194 | rst <= '1'; | |||
117 | WAIT UNTIL clk = '1'; |
|
195 | WAIT UNTIL clk = '1'; | |
118 | WAIT UNTIL clk = '1'; |
|
196 | WAIT UNTIL clk = '1'; | |
119 | WAIT UNTIL clk = '1'; |
|
197 | WAIT UNTIL clk = '1'; | |
120 | rstn <= '1'; |
|
198 | rstn <= '1'; | |
|
199 | rst <= '0'; | |||
121 | WAIT UNTIL end_of_simu = '1'; |
|
200 | WAIT UNTIL end_of_simu = '1'; | |
122 | WAIT FOR 10 ps; |
|
201 | WAIT FOR 10 ps; | |
123 | assert false report "end of test" severity note; |
|
202 | assert false report "end of test" severity note; | |
124 | -- Wait forever; this will finish the simulation. |
|
203 | -- Wait forever; this will finish the simulation. | |
125 | wait; |
|
204 | wait; | |
126 | END PROCESS; |
|
205 | END PROCESS; | |
127 | ----------------------------------------------------------------------------- |
|
206 | ----------------------------------------------------------------------------- | |
128 |
|
207 | |||
129 |
|
208 | |||
130 |
clk |
|
209 | clk49_152MHz_gen:PROCESS | |
131 | BEGIN |
|
210 | BEGIN | |
132 | IF end_of_simu /= '1' THEN |
|
211 | IF end_of_simu /= '1' THEN | |
133 |
clk |
|
212 | clk49_152MHz <= NOT clk49_152MHz; | |
134 | WAIT FOR half_samplig_period; |
|
213 | WAIT FOR 10173 ps; | |
135 | ELSE |
|
214 | ELSE | |
136 | WAIT FOR 10 ps; |
|
215 | WAIT FOR 10 ps; | |
137 | assert false report "end of test" severity note; |
|
216 | assert false report "end of test" severity note; | |
138 | WAIT; |
|
217 | WAIT; | |
139 | END IF; |
|
218 | END IF; | |
140 | END PROCESS; |
|
219 | END PROCESS; | |
141 |
|
220 | |||
142 |
clk_ |
|
221 | clk_50M_gen:PROCESS | |
143 | BEGIN |
|
222 | BEGIN | |
144 | IF end_of_simu /= '1' THEN |
|
223 | IF end_of_simu /= '1' THEN | |
145 | clk <= NOT clk; |
|
224 | clk <= NOT clk; | |
146 | TSTAMP <= TSTAMP+20; |
|
225 | TSTAMP <= TSTAMP+20; | |
147 |
WAIT FOR |
|
226 | WAIT FOR 10 ns; | |
148 | ELSE |
|
227 | ELSE | |
149 | WAIT FOR 10 ps; |
|
228 | WAIT FOR 10 ps; | |
150 | assert false report "end of test" severity note; |
|
229 | assert false report "end of test" severity note; | |
151 | WAIT; |
|
230 | WAIT; | |
152 | END IF; |
|
231 | END IF; | |
153 | END PROCESS; |
|
232 | END PROCESS; | |
154 |
|
233 | |||
155 |
|
234 | |||
156 | ----------------------------------------------------------------------------- |
|
235 | LFR: ENTITY work.LFR_FM | |
157 | -- LPP_LFR_FILTER f1 |
|
236 | GENERIC MAP( | |
158 | ----------------------------------------------------------------------------- |
|
237 | Mem_use => use_RAM, | |
|
238 | USE_BOOTLOADER => 0, | |||
|
239 | USE_ADCDRIVER => 1, | |||
|
240 | tech => inferred, | |||
|
241 | tech_leon => inferred, | |||
|
242 | DEBUG_FORCE_DATA_DMA => 0, | |||
|
243 | USE_DEBUG_VECTOR => 0 | |||
|
244 | ) | |||
|
245 | ||||
|
246 | PORT MAP( | |||
|
247 | clk50MHz => clk, | |||
|
248 | clk49_152MHz => clk49_152MHz, | |||
|
249 | reset => rstn, | |||
|
250 | ||||
|
251 | TAG => OPEN, | |||
|
252 | ||||
|
253 | address => address, | |||
|
254 | data => data, | |||
159 |
|
255 | |||
160 | IIR_CEL_f0_to_f1 : IIR_CEL_CTRLR_v2 |
|
256 | nSRAM_MBE => nSRAM_MBE, | |
161 | GENERIC MAP ( |
|
257 | nSRAM_E1 => nSRAM_E1, | |
162 | tech => tech, |
|
258 | nSRAM_E2 => nSRAM_E2, | |
163 | Mem_use => Mem_use, -- use_RAM |
|
259 | -- nSRAM_SCRUB : OUT STD_LOGIC; -- new | |
164 | Sample_SZ => 18, |
|
260 | nSRAM_W => nSRAM_W, | |
165 | Coef_SZ => f0_to_f1_COEFFICIENT_SIZE, |
|
261 | nSRAM_G => nSRAM_G, | |
166 | Coef_Nb => f0_to_f1_CEL_NUMBER*5, |
|
262 | nSRAM_BUSY => nSRAM_BUSY, | |
167 | Coef_sel_SZ => 5, |
|
263 | -- SPW -------------------------------------------------------------------- | |
168 | Cels_count => f0_to_f1_CEL_NUMBER, |
|
264 | spw1_en => spw1_en, | |
169 | ChanelsCount => ChanelCount, |
|
265 | spw1_din => spw1_din, | |
170 | FILENAME => "" |
|
266 | spw1_sin => spw1_sin, | |
171 | ) |
|
267 | spw1_dout => spw1_dout, | |
172 | PORT MAP ( |
|
268 | spw1_sout => spw1_sout, | |
173 |
|
|
269 | spw2_en => spw2_en, | |
174 | clk => clk, |
|
270 | spw2_din => spw2_din, | |
175 | virg_pos => f0_to_f1_POINT_POSITION, |
|
271 | spw2_sin => spw2_sin, | |
176 | coefs => coefs_iir_cel_f0_to_f1, |
|
272 | spw2_dout => spw2_dout, | |
177 |
|
273 | spw2_sout => spw2_sout, | ||
178 | sample_in_val => sample_val, |
|
274 | -- ADC -------------------------------------------------------------------- | |
179 | sample_in => sample, |
|
275 | bias_fail_sw => bias_fail_sw, | |
180 | sample_out_val => sample_fx_val, |
|
276 | ADC_OEB_bar_CH => ADC_OEB_bar_CH, | |
181 | sample_out => sample_fx); |
|
277 | ADC_smpclk => ADC_smpclk, | |
182 |
|
278 | ADC_data => ADC_data, | ||
183 |
|
|
279 | -- DAC -------------------------------------------------------------------- | |
|
280 | DAC_SDO => DAC_SDO, | |||
|
281 | DAC_SCK => DAC_SCK, | |||
|
282 | DAC_SYNC => DAC_SYNC, | |||
|
283 | DAC_CAL_EN => DAC_CAL_EN, | |||
|
284 | -- HK --------------------------------------------------------------------- | |||
|
285 | HK_smpclk => HK_smpclk, | |||
|
286 | ADC_OEB_bar_HK => ADC_OEB_bar_HK, | |||
|
287 | HK_SEL => HK_SEL | |||
|
288 | ); | |||
184 |
|
289 | |||
185 |
|
290 | |||
|
291 | spw2_din <= '1'; | |||
|
292 | spw2_sin <= '1'; | |||
186 | ----------------------------------------------------------------------------- |
|
293 | ----------------------------------------------------------------------------- | |
187 | -- SAMPLE GENERATION |
|
294 | -- SRAMS Same as EM, we don't have UT8ER1M32 models | |
188 | ----------------------------------------------------------------------------- |
|
295 | ----------------------------------------------------------------------------- | |
|
296 | nSRAM_BUSY <= '1'; -- TODO emulate scrubbing | |||
|
297 | ||||
|
298 | nSRAM_CE <= not nSRAM_E1; | |||
|
299 | ||||
|
300 | async_1Mx16_0: CY7C1061DV33 | |||
|
301 | GENERIC MAP ( | |||
|
302 | ADDR_BITS => 19, | |||
|
303 | DATA_BITS => 16, | |||
|
304 | depth => 1048576, | |||
|
305 | MEM_ARRAY_DEBUG => 32, | |||
|
306 | TimingInfo => TRUE, | |||
|
307 | TimingChecks => '1') | |||
|
308 | PORT MAP ( | |||
|
309 | CE1_b => '0', | |||
|
310 | CE2 => nSRAM_CE, | |||
|
311 | WE_b => nSRAM_W, | |||
|
312 | OE_b => nSRAM_G, | |||
|
313 | BHE_b => '0', | |||
|
314 | BLE_b => '0', | |||
|
315 | A => address, | |||
|
316 | DQ => data(15 DOWNTO 0)); | |||
|
317 | ||||
|
318 | async_1Mx16_1: CY7C1061DV33 | |||
|
319 | GENERIC MAP ( | |||
|
320 | ADDR_BITS => 19, | |||
|
321 | DATA_BITS => 16, | |||
|
322 | depth => 1048576, | |||
|
323 | MEM_ARRAY_DEBUG => 32, | |||
|
324 | TimingInfo => TRUE, | |||
|
325 | TimingChecks => '1') | |||
|
326 | PORT MAP ( | |||
|
327 | CE1_b => '0', | |||
|
328 | CE2 => nSRAM_CE, | |||
|
329 | WE_b => nSRAM_W, | |||
|
330 | OE_b => nSRAM_G, | |||
|
331 | BHE_b => '0', | |||
|
332 | BLE_b => '0', | |||
|
333 | A => address, | |||
|
334 | DQ => data(31 DOWNTO 16)); | |||
189 |
|
335 | |||
190 |
|
336 | |||
191 | PROCESS (clk, rstn) |
|
|||
192 | BEGIN -- PROCESS |
|
|||
193 | IF rstn = '0' THEN -- asynchronous reset (active low) |
|
|||
194 | sample_val <= '0'; |
|
|||
195 | clk_24576Hz_r <= '0'; |
|
|||
196 | ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge |
|
|||
197 | clk_24576Hz_r <= clk_24576Hz; |
|
|||
198 | IF clk_24576Hz = '1' AND clk_24576Hz_r = '0' THEN |
|
|||
199 | sample_val <= '1'; |
|
|||
200 | ELSE |
|
|||
201 | sample_val <= '0'; |
|
|||
202 | END IF; |
|
|||
203 | END IF; |
|
|||
204 | END PROCESS; |
|
|||
205 | ----------------------------------------------------------------------------- |
|
|||
206 |
|
||||
207 | ChanelLoop : FOR i IN 0 TO ChanelCount-1 GENERATE |
|
|||
208 | SampleLoop : FOR j IN 0 TO 15 GENERATE |
|
|||
209 | sample_fx_wdata(i)(j) <= sample_fx(i,j); |
|
|||
210 | signal_rec(i,j) <= sample_fx_wdata(i)(j); |
|
|||
211 | sample(i,j) <= signal_gen(i,j); |
|
|||
212 | END GENERATE; |
|
|||
213 | sample(i,16) <= signal_gen(i,16); |
|
|||
214 | sample(i,17) <= signal_gen(i,17); |
|
|||
215 | END GENERATE; |
|
|||
216 |
|
337 | |||
217 |
|
338 | |||
218 |
|
339 | |||
219 | ----------------------------------------------------------------------------- |
|
340 | SPW: spwstream | |
220 | -- READ INPUT SIGNALS |
|
341 | ||
221 | ----------------------------------------------------------------------------- |
|
342 | generic map( | |
|
343 | sysfreq => 50.0e6, | |||
|
344 | txclkfreq => 50.0e6, | |||
|
345 | rximpl => impl_generic, | |||
|
346 | rxchunk => 1, | |||
|
347 | tximpl => impl_generic, | |||
|
348 | rxfifosize_bits => 11, | |||
|
349 | txfifosize_bits => 11 | |||
|
350 | ) | |||
|
351 | ||||
|
352 | port map( | |||
|
353 | -- System clock. | |||
|
354 | clk => clk, | |||
|
355 | rxclk => clk, | |||
|
356 | txclk => clk, | |||
|
357 | rst => rst, | |||
|
358 | autostart => autostart, | |||
|
359 | linkstart => linkstart, | |||
|
360 | linkdis => linkdis, | |||
|
361 | txdivcnt => X"00", | |||
|
362 | tick_in => '0', | |||
|
363 | ||||
|
364 | -- Control bits of the TimeCode to be sent. Must be valid while tick_in is high. | |||
|
365 | ctrl_in => ctrl_in, | |||
|
366 | ||||
|
367 | -- Counter value of the TimeCode to be sent. Must be valid while tick_in is high. | |||
|
368 | time_in => time_in, | |||
|
369 | ||||
|
370 | -- Pulled high by the application to write an N-Char to the transmit | |||
|
371 | -- queue. If "txwrite" and "txrdy" are both high on the rising edge | |||
|
372 | -- of "clk", a character is added to the transmit queue. | |||
|
373 | -- This signal has no effect if "txrdy" is low. | |||
|
374 | txwrite => txwrite, | |||
|
375 | ||||
|
376 | -- Control flag to be sent with the next N_Char. | |||
|
377 | -- Must be valid while txwrite is high. | |||
|
378 | txflag => txflag, | |||
|
379 | ||||
|
380 | -- Byte to be sent, or "00000000" for EOP or "00000001" for EEP. | |||
|
381 | -- Must be valid while txwrite is high. | |||
|
382 | txdata => txdata, | |||
|
383 | ||||
|
384 | -- High if the entity is ready to accept an N-Char for transmission. | |||
|
385 | txrdy => txrdy, | |||
|
386 | ||||
|
387 | -- High if the transmission queue is at least half full. | |||
|
388 | txhalff => txhalff, | |||
|
389 | ||||
|
390 | -- High for one clock cycle if a TimeCode was just received. | |||
|
391 | tick_out => tick_out, | |||
|
392 | ||||
|
393 | -- Control bits of the last received TimeCode. | |||
|
394 | ctrl_out => ctrl_out, | |||
|
395 | ||||
|
396 | -- Counter value of the last received TimeCode. | |||
|
397 | time_out => time_out, | |||
222 |
|
398 | |||
223 | gen: sig_reader |
|
399 | -- High if "rxflag" and "rxdata" contain valid data. | |
224 | GENERIC MAP( |
|
400 | -- This signal is high unless the receive FIFO is empty. | |
225 | FNAME => "input.txt", |
|
401 | rxvalid => rxvalid, | |
226 | WIDTH => ChanelCount, |
|
402 | ||
227 | RESOLUTION => 18, |
|
403 | -- High if the receive FIFO is at least half full. | |
228 | GAIN => 1.0 |
|
404 | rxhalff => rxhalff, | |
229 | ) |
|
405 | ||
230 | PORT MAP( |
|
406 | -- High if the received character is EOP or EEP; low if the received | |
231 | clk => sample_val, |
|
407 | -- character is a data byte. Valid if "rxvalid" is high. | |
232 | end_of_simu => end_of_simu, |
|
408 | rxflag => rxflag, | |
233 | out_signal => signal_gen |
|
409 | ||
|
410 | -- Received byte, or "00000000" for EOP or "00000001" for EEP. | |||
|
411 | -- Valid if "rxvalid" is high. | |||
|
412 | rxdata => rxdata, | |||
|
413 | ||||
|
414 | -- Pulled high by the application to accept a received character. | |||
|
415 | -- If "rxvalid" and "rxread" are both high on the rising edge of "clk", | |||
|
416 | -- a character is removed from the receive FIFO and "rxvalid", "rxflag" | |||
|
417 | -- and "rxdata" are updated. | |||
|
418 | -- This signal has no effect if "rxvalid" is low. | |||
|
419 | rxread => rxread, | |||
|
420 | ||||
|
421 | -- High if the link state machine is currently in the Started state. | |||
|
422 | started => started, | |||
|
423 | ||||
|
424 | -- High if the link state machine is currently in the Connecting state. | |||
|
425 | connecting => connecting, | |||
|
426 | ||||
|
427 | -- High if the link state machine is currently in the Run state, indicating | |||
|
428 | -- that the link is fully operational. If none of started, connecting or running | |||
|
429 | -- is high, the link is in an initial state and the transmitter is not yet enabled. | |||
|
430 | running => running, | |||
|
431 | ||||
|
432 | -- Disconnect detected in state Run. Triggers a reset and reconnect of the link. | |||
|
433 | -- This indication is auto-clearing. | |||
|
434 | errdisc => errdisc, | |||
|
435 | ||||
|
436 | -- Parity error detected in state Run. Triggers a reset and reconnect of the link. | |||
|
437 | -- This indication is auto-clearing. | |||
|
438 | errpar => errpar, | |||
|
439 | ||||
|
440 | -- Invalid escape sequence detected in state Run. Triggers a reset and reconnect of | |||
|
441 | -- the link. This indication is auto-clearing. | |||
|
442 | erresc => erresc, | |||
|
443 | ||||
|
444 | -- Credit error detected. Triggers a reset and reconnect of the link. | |||
|
445 | -- This indication is auto-clearing. | |||
|
446 | errcred => errcred, | |||
|
447 | ||||
|
448 | -- Data In signal from SpaceWire bus. | |||
|
449 | spw_di => spw1_dout, | |||
|
450 | ||||
|
451 | -- Strobe In signal from SpaceWire bus. | |||
|
452 | spw_si => spw1_sout, | |||
|
453 | ||||
|
454 | -- Data Out signal to SpaceWire bus. | |||
|
455 | spw_do => spw1_din, | |||
|
456 | ||||
|
457 | -- Strobe Out signal to SpaceWire bus. | |||
|
458 | spw_so => spw1_sin | |||
234 | ); |
|
459 | ); | |
235 |
|
460 | |||
236 |
|
461 | |||
|
462 | ||||
|
463 | ||||
|
464 | ||||
|
465 | ||||
237 | ----------------------------------------------------------------------------- |
|
466 | ----------------------------------------------------------------------------- | |
238 | -- RECORD OUTPUT SIGNALS |
|
467 | -- RECORD OUTPUT SIGNALS | |
239 | ----------------------------------------------------------------------------- |
|
468 | ----------------------------------------------------------------------------- | |
240 |
|
469 | |||
241 | rec : sig_recorder |
|
470 | ||
242 | GENERIC MAP( |
|
|||
243 | FNAME => "output_fx.txt", |
|
|||
244 | WIDTH => ChanelCount, |
|
|||
245 | RESOLUTION => 16 |
|
|||
246 | ) |
|
|||
247 | PORT MAP( |
|
|||
248 | clk => sample_fx_val, |
|
|||
249 | end_of_simu => end_of_simu, |
|
|||
250 | timestamp => TSTAMP, |
|
|||
251 | input_signal => signal_rec |
|
|||
252 | ); |
|
|||
253 |
|
471 | |||
254 | END; |
|
472 | END; |
General Comments 0
You need to be logged in to leave comments.
Login now