##// END OF EJS Templates
ICI4 EGSE now working, need some more cleaning.
Alexis Jeandet -
r219:df1aff8cd31b alexis
parent child
Show More
@@ -0,0 +1,53
1 -- DC_GATE_GEN.vhd
2 library IEEE;
3 use IEEE.std_logic_1164.all;
4 use IEEE.numeric_std.all;
5
6
7
8
9
10
11
12
13 entity DC_GATE_GEN is
14 generic(WordCnt : integer := 144);
15 port
16 (
17 clk : in std_logic;
18 Wcount : in integer range 0 to WordCnt-1;
19 Gate : out std_logic
20 );
21 end entity;
22
23
24
25
26 architecture ar_DC_GATE_GEN of DC_GATE_GEN is
27 begin
28 process(clk)
29 begin
30 if clk'event and clk ='0' then
31 case Wcount is
32 when 48 =>
33 gate <= '1';
34 when 49 =>
35 gate <= '1';
36
37 when 50 =>
38 gate <= '1';
39 when 51 =>
40 gate <= '1';
41
42 when 52 =>
43 gate <= '1';
44 when 53 =>
45 gate <= '1';
46
47
48 when others =>
49 gate <= '0';
50 end case;
51 end if;
52 end process;
53 end architecture; No newline at end of file
@@ -0,0 +1,98
1 -- ICI_EGSE_PROTOCOL.vhd
2 -- ICI_EGSE_PROTOCOL.vhd
3 library IEEE;
4 use IEEE.std_logic_1164.all;
5 use IEEE.numeric_std.all;
6
7 entity ICI_EGSE_PROTOCOL is
8 generic(WordSize : integer := 8;WordCnt : integer :=144;MinFCount : integer := 64;Simu : integer :=0);
9 port(
10 clk : in std_logic;
11 reset : in std_logic;
12 WEN : in std_logic;
13 WordCnt_in : in integer range 0 to WordCnt-1;
14 MinfCnt_in : in integer range 0 to MinFCount-1;
15 DATAIN : in std_logic_vector (WordSize-1 downto 0);
16 FULL : in std_logic;
17 WR : out std_logic;
18 DATAOUT : out std_logic_vector (WordSize-1 downto 0)
19 );
20 end ICI_EGSE_PROTOCOL;
21
22
23 architecture ar_ICI_EGSE_PROTOCOL of ICI_EGSE_PROTOCOL is
24
25 type DATA_pipe_t is array(NATURAL RANGE <>) of std_logic_vector (WordSize-1 downto 0);
26
27 signal DATA_pipe : DATA_pipe_t(10 downto 0);
28 signal WR_pipe : std_logic_vector(10 downto 0);
29 signal headerSended : std_logic := '0';
30
31
32 begin
33
34 WR <= WR_pipe(0);
35
36 DATAOUT <= DATA_pipe(0);
37
38
39 process(reset,clk)
40 begin
41 if reset = '0' then
42 WR_pipe(10 downto 0) <= (others => '1');
43 rstloop: for i in 0 to 10 loop
44 DATA_pipe(i) <= X"00";
45 end loop;
46 headerSended <= '0';
47 elsif clk'event and clk ='1' then
48 if WordCnt_in = 1 and headerSended = '0' then
49 WR_pipe(4 downto 1) <= (others => '0');
50 WR_pipe(1) <= '0';
51 WR_pipe(3) <= '0';
52 WR_pipe(5) <= '0';
53 WR_pipe(7) <= '0';
54 WR_pipe(9) <= '0';
55 DATA_pipe(1) <= X"0F";
56 DATA_pipe(3) <= X"5a";
57 DATA_pipe(5) <= X"a5";
58 DATA_pipe(7) <= X"F0";
59 DATA_pipe(9) <= std_logic_vector(TO_UNSIGNED(MinfCnt_in,WordSize));
60 WR_pipe(0) <= '1';
61 WR_pipe(2) <= '1';
62 WR_pipe(4) <= '1';
63 WR_pipe(6) <= '1';
64 WR_pipe(8) <= '1';
65 WR_pipe(10) <= '1';
66 DATA_pipe(0) <= X"00";
67 DATA_pipe(2) <= X"00";
68 DATA_pipe(4) <= X"00";
69 DATA_pipe(6) <= X"00";
70 DATA_pipe(10) <= X"00";
71 headerSended <= '1';
72 elsif (FULL = '0') then
73 if WordCnt_in /= 1 then
74 headerSended <= '0';
75 end if;
76 DATA_pipe(0) <= DATA_pipe(1);
77 DATA_pipe(1) <= DATA_pipe(2);
78 DATA_pipe(2) <= DATA_pipe(3);
79 DATA_pipe(3) <= DATA_pipe(4);
80 DATA_pipe(4) <= DATA_pipe(5);
81 DATA_pipe(5) <= DATA_pipe(6);
82 DATA_pipe(6) <= DATA_pipe(7);
83 DATA_pipe(7) <= DATA_pipe(8);
84 DATA_pipe(8) <= DATA_pipe(9);
85 DATA_pipe(9) <= DATA_pipe(10);
86 DATA_pipe(10) <= DATAIN;
87 WR_pipe(10 downto 0) <= WEN & WR_pipe(10 downto 1);
88 else
89 WR_pipe(0) <= '1';
90 if WordCnt_in /= 1 then
91 headerSended <= '0';
92 end if;
93 end if;
94 end if;
95 end process;
96
97
98 end ar_ICI_EGSE_PROTOCOL; No newline at end of file
@@ -0,0 +1,87
1 -- ICI_EGSE_PROTOCOL.vhd
2 -- ICI_EGSE_PROTOCOL.vhd
3 library IEEE;
4 use IEEE.std_logic_1164.all;
5 use IEEE.numeric_std.all;
6
7 entity ICI_EGSE_PROTOCOL2 is
8 generic(WordSize : integer := 8;Simu : integer :=0);
9 port(
10 clk : in std_logic;
11 reset : in std_logic;
12 WEN : in std_logic;
13 MinF : in std_logic;
14 DATAIN : in std_logic_vector (WordSize-1 downto 0);
15 FULL : in std_logic;
16 WR : out std_logic;
17 DATAOUT : out std_logic_vector (WordSize-1 downto 0)
18 );
19 end ICI_EGSE_PROTOCOL2;
20
21
22 architecture ar_ICI_EGSE_PROTOCOL2 of ICI_EGSE_PROTOCOL2 is
23
24 type state_t is (idle,forward,header1,header2,header3,header4);
25 signal MinFReg : std_logic;
26 signal state : state_t;
27
28 begin
29
30 process(reset,clk)
31 begin
32 if reset = '0' then
33 MinFReg <= '1';
34 state <= idle;
35 DATAOUT <= X"00";
36 WR <= '1';
37 elsif clk'event and clk ='1' then
38 MinFReg <= MinF;
39 case state is
40 when idle =>
41 DATAOUT <= X"00";
42 WR <= '1';
43 state <= forward;
44 when forward =>
45 DATAOUT <= DATAIN;
46 WR <= WEN;
47 if MinFReg = '0' and MinF = '1' then
48 state <= header1;
49 end if;
50 when header1 =>
51 if FULL = '0' then
52 WR <= '0';
53 DATAOUT <= X"5a";
54 state <= header2;
55 else
56 WR <= '1';
57 end if;
58 when header2 =>
59 if FULL = '0' then
60 WR <= '0';
61 DATAOUT <= X"F0";
62 state <= header3;
63 else
64 WR <= '1';
65 end if;
66 when header3 =>
67 if FULL = '0' then
68 WR <= '0';
69 DATAOUT <= X"0F";
70 state <= header4;
71 else
72 WR <= '1';
73 end if;
74 when header4 =>
75 if FULL = '0' then
76 WR <= '0';
77 DATAOUT <= X"a5";
78 state <= forward;
79 else
80 WR <= '1';
81 end if;
82 end case;
83 end if;
84 end process;
85
86
87 end ar_ICI_EGSE_PROTOCOL2; No newline at end of file
@@ -0,0 +1,116
1 -- LF_GATE_GEN.vhd
2 library IEEE;
3 use IEEE.std_logic_1164.all;
4 use IEEE.numeric_std.all;
5
6
7
8
9
10
11
12
13 entity LF_GATE_GEN is
14 generic(WordCnt : integer := 144);
15 port
16 (
17 clk : in std_logic;
18 Wcount : in integer range 0 to WordCnt-1;
19 Gate : out std_logic
20 );
21 end entity;
22
23
24
25
26 architecture ar_LF_GATE_GEN of LF_GATE_GEN is
27 begin
28 process(clk)
29 begin
30 if clk'event and clk ='0' then
31 case Wcount is
32 when 6 =>
33 gate <= '1';
34 when 7 =>
35 gate <= '1';
36 when 8 =>
37 gate <= '1';
38 when 9 =>
39 gate <= '1';
40 when 10 =>
41 gate <= '1';
42 when 11 =>
43 gate <= '1';
44
45 when 30 =>
46 gate <= '1';
47 when 31 =>
48 gate <= '1';
49 when 32 =>
50 gate <= '1';
51 when 33 =>
52 gate <= '1';
53 when 34 =>
54 gate <= '1';
55 when 35 =>
56 gate <= '1';
57
58 when 54 =>
59 gate <= '1';
60 when 55 =>
61 gate <= '1';
62 when 56 =>
63 gate <= '1';
64 when 57 =>
65 gate <= '1';
66 when 58 =>
67 gate <= '1';
68 when 59 =>
69 gate <= '1';
70
71 when 78 =>
72 gate <= '1';
73 when 79 =>
74 gate <= '1';
75 when 80 =>
76 gate <= '1';
77 when 81 =>
78 gate <= '1';
79 when 82 =>
80 gate <= '1';
81 when 83 =>
82 gate <= '1';
83
84 when 102 =>
85 gate <= '1';
86 when 103 =>
87 gate <= '1';
88 when 104 =>
89 gate <= '1';
90 when 105 =>
91 gate <= '1';
92 when 106 =>
93 gate <= '1';
94 when 107 =>
95 gate <= '1';
96
97 when 126 =>
98 gate <= '1';
99 when 127 =>
100 gate <= '1';
101 when 128 =>
102 gate <= '1';
103 when 129 =>
104 gate <= '1';
105 when 130 =>
106 gate <= '1';
107 when 131 =>
108 gate <= '1';
109
110
111 when others =>
112 gate <= '0';
113 end case;
114 end if;
115 end process;
116 end architecture; No newline at end of file
@@ -0,0 +1,42
1 -- MajF_Gen.vhd
2 library IEEE;
3 use IEEE.std_logic_1164.all;
4 use IEEE.numeric_std.all;
5
6
7
8 entity MajF_Gen is
9 generic(WordCnt : integer :=144;MinFCount : integer := 64);
10 port(
11 clk : in std_logic;
12 reset : in std_logic;
13 WordCnt_in : in integer range 0 to WordCnt-1;
14 MinfCnt_in : in integer range 0 to MinFCount-1;
15 WordClk : in std_logic;
16 MajF_Clk : out std_logic
17 );
18 end entity;
19
20
21
22
23
24
25 architecture arMajF_Gen of MajF_Gen is
26
27 begin
28
29 process(clk)
30 begin
31 if reset = '0' then
32 MajF_Clk <= '0';
33 elsif clk'event and clk = '0' then
34 if WordCnt_in = 0 and MinfCnt_in = 0 and WordClk = '1' then
35 MajF_Clk <= '1';
36 else
37 MajF_Clk <= '0';
38 end if;
39 end if;
40 end process;
41
42 end architecture; No newline at end of file
@@ -0,0 +1,41
1 -- MinF_Gen.vhd
2 library IEEE;
3 use IEEE.std_logic_1164.all;
4 use IEEE.numeric_std.all;
5
6
7
8 entity MinF_Gen is
9 generic(WordCnt : integer :=144);
10 port(
11 clk : in std_logic;
12 reset : in std_logic;
13 WordCnt_in : in integer range 0 to WordCnt-1;
14 WordClk : in std_logic;
15 MinF_Clk : out std_logic
16 );
17 end entity;
18
19
20
21
22
23
24 architecture arMinF_Gen of MinF_Gen is
25
26 begin
27
28 process(clk)
29 begin
30 if reset = '0' then
31 MinF_Clk <= '0';
32 elsif clk'event and clk = '0' then
33 if WordCnt_in = 0 and WordClk = '1' then
34 MinF_Clk <= '1';
35 else
36 MinF_Clk <= '0';
37 end if;
38 end if;
39 end process;
40
41 end architecture; No newline at end of file
@@ -0,0 +1,62
1 -- Serial_driver.vhd
2 library IEEE;
3 use IEEE.std_logic_1164.all;
4 use IEEE.numeric_std.all;
5
6
7
8
9
10 entity Serial_driver2 is
11 generic(Sz : integer := 8);
12 port(
13 Sclk : in std_logic;
14 rstn : in std_logic;
15 Sdata : in std_logic;
16 Gate : in std_logic;
17 NwDat : out std_logic;
18 Data : out std_logic_vector(Sz-1 downto 0)
19 );
20 end entity;
21
22
23
24 architecture arSerial_driver2 of Serial_driver2 is
25 signal DataR : std_logic_vector(Sz-1 downto 0);
26 signal DataCnt : integer range 0 to Sz-1 :=0;
27 signal DataCntR : integer range 0 to Sz-1 :=0;
28 begin
29
30
31 process(rstn,Sclk)
32 begin
33 if rstn = '0' then
34 DataR <= (others=>'0');
35 NwDat <= '0';
36 elsif Sclk'event and Sclk ='1' then
37 DataCntR <= DataCnt;
38 if DataCntR = Sz-1 then
39 NwDat <= '1';
40 Data <= DataR;
41 else
42 NwDat <= '0';
43 end if;
44 if Gate ='1' then
45 DataR <= DataR(Sz-2 downto 0) & Sdata;
46 if DataCnt = Sz-1 then
47 DataCnt <= 0;
48 else
49 DataCnt <= DataCnt +1;
50 end if;
51 else
52 DataCnt <= 0;
53 end if;
54 end if;
55 end process;
56
57
58 end architecture;
59
60
61
62
@@ -0,0 +1,61
1 -- LF_GATE_GEN.vhd
2 library IEEE;
3 use IEEE.std_logic_1164.all;
4 use IEEE.numeric_std.all;
5
6
7
8
9
10
11
12
13 entity testbench is
14 port
15 (
16 );
17 end entity;
18
19
20
21
22 architecture ar_testbench of testbench is
23 signal Clock : std_logic;
24 signal reset : std_logic;
25 signal DataRTX : std_logic;
26 signal DataRTX_echo : std_logic;
27 signal SCLK : std_logic;
28 signal Gate : std_logic;
29 signal Major_Frame : std_logic;
30 signal Minor_Frame : std_logic;
31 signal if_clk : STD_LOGIC;
32 signal flagb : STD_LOGIC;
33 signal slwr : STD_LOGIC;
34 signal slrd : std_logic;
35 signal pktend : STD_LOGIC;
36 signal sloe : STD_LOGIC;
37 signal fdbusw : std_logic_vector (7 downto 0);
38 signal fifoadr : std_logic_vector (1 downto 0);
39
40 begin
41 EGSE: entity TOP_EGSE2
42 generic map(8,144,64,1)
43 port map(Clock,
44 reset,
45 DataRTX,
46 DataRTX_echo,
47 SCLK,
48 Gate,
49 Major_Frame,
50 Minor_Frame,
51 if_clk,
52 flagb,
53 slwr,
54 slrd,
55 pktend,
56 sloe,
57 fdbusw,
58 fifoadr
59 );
60
61 end architecture; No newline at end of file
@@ -13,6 +13,7 set_iobank Bank0 -vcci 3.30 -fixed no
13
13
14 set_io Clock -iostd LVTTL -REGISTER No -RES_PULL None -pinname 151 -fixed yes
14 set_io Clock -iostd LVTTL -REGISTER No -RES_PULL None -pinname 151 -fixed yes
15 set_io DataRTX -iostd LVTTL -REGISTER No -RES_PULL None -pinname 190 -fixed yes
15 set_io DataRTX -iostd LVTTL -REGISTER No -RES_PULL None -pinname 190 -fixed yes
16 set_io DataRTX_echo -iostd LVTTL -REGISTER No -RES_PULL None -pinname 42 -fixed yes
16 set_io Gate -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 189 -fixed yes
17 set_io Gate -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 189 -fixed yes
17 set_io Major_Frame -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 185 -fixed yes
18 set_io Major_Frame -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 185 -fixed yes
18 set_io Minor_Frame -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 183 -fixed yes
19 set_io Minor_Frame -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 183 -fixed yes
@@ -36,4 +37,11 set_io reset -iostd LVTTL -REGISTER No -
36 #set_io sclkbis -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 180 -fixed yes
37 #set_io sclkbis -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 180 -fixed yes
37 set_io sloe -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 153 -fixed yes
38 set_io sloe -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 153 -fixed yes
38 set_io slrd -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 167 -fixed yes
39 set_io slrd -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 167 -fixed yes
39 set_io slwr -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 166 -fixed yes No newline at end of file
40 set_io slwr -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 166 -fixed yes
41 set_io BUS0 -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 48 -fixed yes
42 set_io BUS12 -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 9 -fixed yes
43 set_io BUS13 -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 7 -fixed yes
44 set_io BUS14 -iostd LVTTL -REGISTER No -OUT_DRIVE 12 -SLEW High -RES_PULL None -SKEW Off -OUT_LOAD 35 -pinname 5 -fixed yes
45
46
47
@@ -4,15 +4,15 SPEED=Std
4 SYNFREQ=50
4 SYNFREQ=50
5
5
6 PART=A3PE1500
6 PART=A3PE1500
7 DESIGNER_PACKAGE=PQFP
7 DESIGNER_PACKAGE=PQFF
8 DESIGNER_PINS=208
8 DESIGNER_PINS=208
9 DESIGNER_VOLTAGE=COM
9 DESIGNER_VOLTAGE=COM
10 DESIGNER_TEMP=COM
10 DESIGNER_TEMP=COM
11
11
12 MANUFACTURER=Actel
12 MANUFACTURER=Actel
13 MGCPART=$(PART)
13 MGCPART=$(PART)
14 MGCTECHNOLOGY=PROASIC3
14 MGCTECHNOLOGY=ProASIC3E
15 MGCPACKAGE= {$(DESIGNER_PINS) $(DESIGNER_PACKAGE)}
15 MGCPACKAGE= {$(DESIGNER_PINS)$(DESIGNER_PACKAGE)}
16 LIBERO_DIE=IT14X14M4LDP
16 LIBERO_DIE=IT10X10M3
17 LIBERO_PACKAGE=fg$(DESIGNER_PINS)
17 LIBERO_PACKAGE=pq$(DESIGNER_PINS)
18
18
@@ -10,7 +10,9
10 #
10 #
11 # Clocks
11 # Clocks
12 #
12 #
13 define_clock {clk} -name {clk} -freq 60 -clockgroup default_clkgroup -route 5
13 define_clock {clk} -name {clk} -freq 48 -clockgroup default_clkgroup -route 5
14
15 define_clock {SCLKint} -name {SCLKint} -freq 3.3 -clockgroup default_clkgroup -route 5
14
16
15 #
17 #
16 # Clock to Clock
18 # Clock to Clock
@@ -1,158 +1,282
1 -- TOP_GSE.vhd
1 -- TOP_GSE.vhd
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 library lpp;
5 library lpp;
6 use lpp.lpp_usb.all;
6 use lpp.lpp_usb.all;
7 use lpp.Rocket_PCM_Encoder.all;
8 use lpp.iir_filter.all;
9 use lpp.general_purpose.all;
7 library techmap;
10 library techmap;
8 use techmap.gencomp.all;
11 use techmap.gencomp.all;
9
12 use work.config.all;
10 entity TOP_EGSE2 is
13
11 generic(WordSize : integer := 8; WordCnt : integer := 144;MinFCount : integer := 64;Simu : integer :=0);
14
12 port(
15 entity TOP_EGSE2 is
13 Clock : in std_logic;
16 generic(WordSize : integer := 8; WordCnt : integer := 144;MinFCount : integer := 64;Simu : integer :=0);
14 reset : in std_logic;
17 port(
15 DataRTX : in std_logic;
18 Clock : in std_logic;
16 DataRTX_echo : out std_logic;
19 reset : in std_logic;
17 SCLK : out std_logic;
20 DataRTX : in std_logic;
18 Gate : out std_logic;
21 DataRTX_echo : out std_logic;
19 Major_Frame : out std_logic;
22 SCLK : out std_logic;
20 Minor_Frame : out std_logic;
23 Gate : out std_logic;
21 if_clk : out STD_LOGIC;
24 Major_Frame : out std_logic;
22 flagb : in STD_LOGIC;
25 Minor_Frame : out std_logic;
23 slwr : out STD_LOGIC;
26 if_clk : out STD_LOGIC;
24 slrd : out std_logic;
27 flagb : in STD_LOGIC;
25 pktend : out STD_LOGIC;
28 slwr : out STD_LOGIC;
26 sloe : out STD_LOGIC;
29 slrd : out std_logic;
27 fdbusw : out std_logic_vector (7 downto 0);
30 pktend : out STD_LOGIC;
28 fifoadr : out std_logic_vector (1 downto 0)
31 sloe : out STD_LOGIC;
29 );
32 fdbusw : out std_logic_vector (7 downto 0);
30 end TOP_EGSE2;
33 fifoadr : out std_logic_vector (1 downto 0);
31
34 BUS0 : out std_logic;
32
35 BUS12 : out std_logic;
33
36 BUS13 : out std_logic;
34 architecture ar_TOP_EGSE2 of TOP_EGSE2 is
37 BUS14 : out std_logic
35
38 );
36 component CLKINT
39 end TOP_EGSE2;
37 port( A : in std_logic := 'U';
40
38 Y : out std_logic
41
39 );
42
40 end component;
43 architecture ar_TOP_EGSE2 of TOP_EGSE2 is
41
44
42 signal clk : std_logic;
45 component CLKINT
43 signal sclkint : std_logic;
46 port( A : in std_logic := 'U';
44 signal RaZ : std_logic;
47 Y : out std_logic
45 signal rstn : std_logic;
48 );
46 signal WordCount : integer range 0 to WordCnt-1;
49 end component;
47 signal WordClk : std_logic;
50
48 signal MinFCnt : integer range 0 to MinFCount-1;
51 signal clk : std_logic;
49 signal MinF : std_logic;
52 signal clk_48 : std_logic;
50 signal MinFclk : std_logic;
53 signal sclkint : std_logic;
51 signal MajF : std_logic;
54 signal RaZ : std_logic;
52 signal GateLF : std_logic;
55 signal rstn : std_logic;
53 signal GateHF : std_logic;
56 signal WordCount : integer range 0 to WordCnt-1;
54 signal GateDC : std_logic;
57 signal WordClk : std_logic;
55 signal Gateint : std_logic;
58 signal MinFCnt : integer range 0 to MinFCount-1;
56 signal GateR : std_logic;
59 signal MinF : std_logic;
57 signal NwDat : std_logic;
60 signal MinFclk : std_logic;
58 signal DATA : std_logic_vector(WordSize-1 downto 0);
61 signal MajF : std_logic;
59
62 signal GateLF : std_logic;
60 Signal FIFODATin : std_logic_vector(7 downto 0);
63 signal GateHF : std_logic;
61 Signal FIFODATout : std_logic_vector(7 downto 0);
64 signal GateDC : std_logic;
62
65 signal GateR : std_logic;
63 Signal USB_DATA : std_logic_vector(7 downto 0);
66 signal Gateint : std_logic;
64 Signal FIFOwe,FIFOre,FIFOfull : std_logic;
67 signal NwDat : std_logic;
65 Signal USBwe,USBfull,USBempty : std_logic;
68 signal NwDatR : std_logic;
66
69 signal DATA : std_logic_vector(WordSize-1 downto 0);
67 Signal clk80 : std_logic;
70 signal MinFVector : std_logic_vector(WordSize-1 downto 0);
68
71
69
72 Signal PROTO_WEN : std_logic;
70
73 Signal PROTO_DATAIN : std_logic_vector (WordSize-1 downto 0);
71 begin
74 Signal PROTO_FULL : std_logic;
75 Signal PROTO_WR : std_logic;
76 Signal PROTO_DATAOUT : std_logic_vector (WordSize-1 downto 0);
77
78 Signal clk80 : std_logic;
79
80
81
82 begin
83
84
85 DataRTX_echo <= DataRTX; --P48
86
87
88 ck_int0 : CLKINT
89 port map(Clock,clk_48);
90
91 DEFPLL: IF simu = 0 generate
92 PLL : entity work.PLL0
93 port map(
94 POWERDOWN => '1',
95 CLKA => clk_48,
96 LOCK => RaZ,
97 GLA => clk80,
98 GLB => clk --33.3MHz
99 );
100 end generate;
101
102
103 SIMPLL: IF simu = 1 generate
104 PLL : entity work.PLL0Sim
105 port map(
106 POWERDOWN => '1',
107 CLKA => clk_48,
108 LOCK => RaZ,
109 GLA => clk80,
110 GLB => clk
111 );
112 end generate;
113
114
115 gene3_3M : entity Clk_Divider2
116 generic map(N => 10)
117 port map(
118 clk_in => clk,
119 clk_out => sclkint
120 );
121
122 Wcounter : entity Word_Cntr
123 generic map(WordSize => WordSize ,N => WordCnt)
124 port map(
125 Sclk => Sclkint,
126 reset => rstn,
127 WordClk => WordClk,
128 Cnt_out => WordCount
129 );
72
130
73
131 MFGEN0 : entity work.MinF_Gen
74 DataRTX_echo <= DataRTX; --P48
132 generic map(WordCnt => WordCnt)
75
133 port map(
76 ck_int0 : CLKINT
134 clk => Sclkint,
77 port map(Clock,clk);
135 reset => rstn,
78
136 WordCnt_in => WordCount,
79 DEFPLL: IF simu = 0 generate
137 WordClk => WordClk,
80 PLL : entity work.PLL0
138 MinF_Clk => MinF
81 port map(
139 );
82 POWERDOWN => '1',
140
83 CLKA => clk,
141 MinFcounter : entity Word_Cntr
84 LOCK => RaZ,
142 generic map(WordSize => WordCnt ,N => MinFCount)
85 GLA => SCLKint,
143 port map(
86 GLB => clk80
144 Sclk => WordClk,
87 );
145 reset => rstn,
88 end generate;
146 WordClk => MinFclk,
89
147 Cnt_out => MinFCnt
90
148 );
91 SIMPLL: IF simu = 1 generate
149
92 PLL : entity work.PLL0Sim
150 MFGEN1 : entity work.MajF_Gen
93 port map(
151 generic map(WordCnt => WordCnt,MinFCount => MinFCount)
94 POWERDOWN => '1',
152 port map(
95 CLKA => clk,
153 clk => Sclkint,
96 LOCK => RaZ,
154 reset => rstn,
97 GLA => SCLKint,
155 WordCnt_in => WordCount,
98 GLB => clk80
156 MinfCnt_in => MinFCnt,
99 );
157 WordClk => WordClk,
100 end generate;
158 MajF_Clk => MajF
101
159 );
102
160
103 USB2: entity work.FX2_WithFIFO
161 LFGATEGEN0 : entity work.LF_GATE_GEN
104 generic map(apa3)
162 generic map(WordCnt => WordCnt)
105 port map(
163 port map(
106 clk => clk,
164 clk => Sclkint,
107 if_clk => if_clk,
165 Wcount => WordCount,
108 reset => rstn,
166 Gate => GateLF
109 flagb => flagb,
167 );
110 slwr => slwr,
168
111 slrd => slrd,
169 DCGATEGEN0 : entity work.DC_GATE_GEN
112 pktend => pktend,
170 generic map(WordCnt => WordCnt)
113 sloe => sloe,
171 port map(
114 fdbusw => fdbusw,
172 clk => Sclkint,
115 fifoadr => fifoadr,
173 Wcount => WordCount,
116 FULL => USBfull,
174 Gate => GateDC
117 Write => USBwe,
175 );
118 Data => USB_DATA
176
119
177 --GateDC <= '0';
120 );
178 --GateLF <= '0';
121
179
122
180 HFGATEGEN0 :
123 rstn <= reset and RaZ;
181 GateHF <= '1' when WordCount = 120 else
182 '1' when WordCount = 121 else '0';
183
184
185
186 SD0 : entity Serial_driver2
187 generic map(Sz => WordSize)
188 port map(
189 Sclk => Sclkint,
190 rstn => rstn,
191 Sdata => DataRTX,
192 Gate => GateR,
193 NwDat => NwDat,
194 Data => DATA
195 );
196
197
198
199 proto: entity work.ICI_EGSE_PROTOCOL
200 generic map(WordSize => WordSize,WordCnt => WordCnt,MinFCount => MinFCount,Simu => 0)
201 port map(
202 clk => clk,
203 -- reset => not MinF,
204 reset => rstn,
205 WEN => PROTO_WEN,
206 MinfCnt_in => MinfCnt,
207 WordCnt_in => WordCount,
208 DATAIN => PROTO_DATAIN,
209 FULL => PROTO_FULL,
210 WR => PROTO_WR,
211 DATAOUT => PROTO_DATAOUT
212 );
213
214
215
216 USB2: entity work.FX2_WithFIFO
217 generic map(CFG_MEMTECH,use_RAM)
218 port map(
219 clk => clk,
220 if_clk => if_clk,
221 reset => rstn,
222 flagb => flagb,
223 slwr => slwr,
224 slrd => slrd,
225 pktend => pktend,
226 sloe => sloe,
227 fdbusw => fdbusw,
228 fifoadr => fifoadr,
229 FULL => PROTO_FULL,
230 wen => PROTO_WR,
231 Data => PROTO_DATAOUT
232 );
233
234
235 rstn <= reset and RaZ;
236 SCLK <= Sclkint;
237
238 Major_Frame <= MajF;
239 --Minor_Frame <= MinF;
240 Minor_Frame <= MinFclk;
241 gateint <= GateDC or GateLF or GateHF;
242 Gate <= gateint;
243
244 process(Sclkint,rstn)
245 begin
246 if rstn = '0' then
247 GateR <= '0';
248 elsif Sclkint'event and Sclkint = '0' then
249 GateR <= Gateint;
250 end if;
251 end process;
252
253 BUS0 <= WordClk;
254 BUS12 <= MinFVector(0);
255 BUS13 <= MinFclk;
256 BUS14 <= '1' when WordCount = 0 else '0';
257
258 MinFVector <= std_logic_vector(TO_UNSIGNED(MinfCnt,WordSize));
259
124
260
125 process(clk,rstn)
261 process(clk,rstn)
126 begin
262 begin
127 if rstn = '0' then
263 if rstn = '0' then
128 USB_DATA <= (others => '0');
264 PROTO_DATAIN <= (others => '0');
129 USBwe <= '0';
265 PROTO_WEN <= '1';
130 elsif clk'event and clk = '1' then
266 elsif clk'event and clk = '1' then
131 if USBfull = '0' then
267 NwDatR <= NwDat;
132 USB_DATA <= std_logic_vector(unsigned(USB_DATA) + 1 );
268 if NwDat = '1' and NwDatR = '0' then
133 USBwe <= '1';
269 PROTO_DATAIN <= std_logic_vector(unsigned(PROTO_DATAIN) + 1 );
270 PROTO_WEN <= '0';
134 else
271 else
135 USBwe <= '0';
272 PROTO_WEN <= '1';
136 end if;
273 end if;
137 end if;
274 end if;
138 end process;
275 end process;
139
276
140 end ar_TOP_EGSE2;
277 end ar_TOP_EGSE2;
141
278
142
279
143
280
144
281
145
282
146
147
148
149
150
151
152
153
154
155
156
157
158
@@ -9,7 +9,7 QSF=$(GRLIB)/boards/$(BOARD)/$(TOP).qsf
9 EFFORT=high
9 EFFORT=high
10 XSTOPT=
10 XSTOPT=
11 SYNPOPT="set_option -pipe 0; set_option -retiming 0; set_option -write_apr_constraint 0"
11 SYNPOPT="set_option -pipe 0; set_option -retiming 0; set_option -write_apr_constraint 0"
12 VHDLSYNFILES=config.vhd EGSE_ICI.vhd
12 VHDLSYNFILES=config.vhd EGSE_ICI.vhd DC_GATE_GEN.vhd LF_GATE_GEN.vhd MajF_Gen.vhd MinF_Gen.vhd Serial_driver.vhd ICI_EGSE_PROTOCOL.vhd
13 VHDLSIMFILES=testbench.vhd
13 VHDLSIMFILES=testbench.vhd
14 SIMTOP=testbench
14 SIMTOP=testbench
15 SDCFILE=$(GRLIB)/boards/$(BOARD)/synplify.sdc
15 SDCFILE=$(GRLIB)/boards/$(BOARD)/synplify.sdc
@@ -22,8 +22,8 TECHLIBS = proasic3
22 LIBSKIP = core1553bbc core1553brm core1553brt gr1553 corePCIF \
22 LIBSKIP = core1553bbc core1553brm core1553brt gr1553 corePCIF \
23 tmtc openchip hynix ihp gleichmann micron usbhc spw fmf gsi eth spansion esa
23 tmtc openchip hynix ihp gleichmann micron usbhc spw fmf gsi eth spansion esa
24 DIRSKIP = b1553 pcif leon2 leon2ft crypto satcan ddr usb ata i2c \
24 DIRSKIP = b1553 pcif leon2 leon2ft crypto satcan ddr usb ata i2c \
25 pci grusbhc haps slink ascs pwm coremp7 spi ac97 spacewire leon3 leon3ft sparc can greth net gr1553b lpp_waveform \
25 pci grusbhc haps slink ascs pwm coremp7 spi ac97 spacewire leon3 leon3ft can greth net gr1553b ./amba_lcd_16x2_ctrlr ./lpp_waveform \
26 lpp_dma
26 ./lpp_dma
27
27
28 FILESKIP = i2cmst.vhd
28 FILESKIP = i2cmst.vhd
29
29
@@ -36,145 +36,5 package config is
36 constant CFG_PCISYSCLK: integer := 0;
36 constant CFG_PCISYSCLK: integer := 0;
37 constant CFG_CLK_NOFB : integer := 0;
37 constant CFG_CLK_NOFB : integer := 0;
38
38
39 -- LEON3 processor core
40 constant CFG_LEON3 : integer := 1;
41 constant CFG_NCPU : integer := (1);
42 constant CFG_NWIN : integer := (7);
43 constant CFG_V8 : integer := 0;
44 constant CFG_MAC : integer := 0;
45 constant CFG_SVT : integer := 0;
46 constant CFG_RSTADDR : integer := 16#00000#;
47 constant CFG_LDDEL : integer := (1);
48 constant CFG_NWP : integer := (0);
49 constant CFG_PWD : integer := 1*2;
50 constant CFG_FPU : integer := 0 + 16*0;
51 constant CFG_GRFPUSH : integer := 0;
52 constant CFG_ICEN : integer := 1;
53 constant CFG_ISETS : integer := 1;
54 constant CFG_ISETSZ : integer := 4;
55 constant CFG_ILINE : integer := 4;
56 constant CFG_IREPL : integer := 0;
57 constant CFG_ILOCK : integer := 0;
58 constant CFG_ILRAMEN : integer := 0;
59 constant CFG_ILRAMADDR: integer := 16#8E#;
60 constant CFG_ILRAMSZ : integer := 1;
61 constant CFG_DCEN : integer := 1;
62 constant CFG_DSETS : integer := 1;
63 constant CFG_DSETSZ : integer := 4;
64 constant CFG_DLINE : integer := 4;
65 constant CFG_DREPL : integer := 0;
66 constant CFG_DLOCK : integer := 0;
67 constant CFG_DSNOOP : integer := 0 + 0 + 4*0;
68 constant CFG_DFIXED : integer := 16#00F3#;
69 constant CFG_DLRAMEN : integer := 0;
70 constant CFG_DLRAMADDR: integer := 16#8F#;
71 constant CFG_DLRAMSZ : integer := 1;
72 constant CFG_MMUEN : integer := 0;
73 constant CFG_ITLBNUM : integer := 2;
74 constant CFG_DTLBNUM : integer := 2;
75 constant CFG_TLB_TYPE : integer := 1 + 0*2;
76 constant CFG_TLB_REP : integer := 1;
77 constant CFG_DSU : integer := 1;
78 constant CFG_ITBSZ : integer := 0;
79 constant CFG_ATBSZ : integer := 0;
80 constant CFG_LEON3FT_EN : integer := 0;
81 constant CFG_IUFT_EN : integer := 0;
82 constant CFG_FPUFT_EN : integer := 0;
83 constant CFG_RF_ERRINJ : integer := 0;
84 constant CFG_CACHE_FT_EN : integer := 0;
85 constant CFG_CACHE_ERRINJ : integer := 0;
86 constant CFG_LEON3_NETLIST: integer := 0;
87 constant CFG_DISAS : integer := 0 + 0;
88 constant CFG_PCLOW : integer := 2;
89
90 -- AMBA settings
91 constant CFG_DEFMST : integer := (0);
92 constant CFG_RROBIN : integer := 1;
93 constant CFG_SPLIT : integer := 0;
94 constant CFG_AHBIO : integer := 16#FFF#;
95 constant CFG_APBADDR : integer := 16#800#;
96 constant CFG_AHB_MON : integer := 0;
97 constant CFG_AHB_MONERR : integer := 0;
98 constant CFG_AHB_MONWAR : integer := 0;
99
100 -- DSU UART
101 constant CFG_AHB_UART : integer := 1;
102
103 -- JTAG based DSU interface
104 constant CFG_AHB_JTAG : integer := 0;
105
106 -- Ethernet DSU
107 constant CFG_DSU_ETH : integer := 0 + 0;
108 constant CFG_ETH_BUF : integer := 1;
109 constant CFG_ETH_IPM : integer := 16#C0A8#;
110 constant CFG_ETH_IPL : integer := 16#0033#;
111 constant CFG_ETH_ENM : integer := 16#00007A#;
112 constant CFG_ETH_ENL : integer := 16#CC0001#;
113
114 -- LEON2 memory controller
115 constant CFG_MCTRL_LEON2 : integer := 1;
116 constant CFG_MCTRL_RAM8BIT : integer := 0;
117 constant CFG_MCTRL_RAM16BIT : integer := 0;
118 constant CFG_MCTRL_5CS : integer := 0;
119 constant CFG_MCTRL_SDEN : integer := 0;
120 constant CFG_MCTRL_SEPBUS : integer := 0;
121 constant CFG_MCTRL_INVCLK : integer := 0;
122 constant CFG_MCTRL_SD64 : integer := 0;
123 constant CFG_MCTRL_PAGE : integer := 0 + 0;
124
125 -- SSRAM controller
126 constant CFG_SSCTRL : integer := 0;
127 constant CFG_SSCTRLP16 : integer := 0;
128
129 -- AHB ROM
130 constant CFG_AHBROMEN : integer := 0;
131 constant CFG_AHBROPIP : integer := 0;
132 constant CFG_AHBRODDR : integer := 16#000#;
133 constant CFG_ROMADDR : integer := 16#000#;
134 constant CFG_ROMMASK : integer := 16#E00# + 16#000#;
135
136 -- AHB RAM
137 constant CFG_AHBRAMEN : integer := 0;
138 constant CFG_AHBRSZ : integer := 1;
139 constant CFG_AHBRADDR : integer := 16#A00#;
140
141 -- Gaisler Ethernet core
142 constant CFG_GRETH : integer := 0;
143 constant CFG_GRETH1G : integer := 0;
144 constant CFG_ETH_FIFO : integer := 8;
145
146 -- CAN 2.0 interface
147 constant CFG_CAN : integer := 0;
148 constant CFG_CANIO : integer := 16#0#;
149 constant CFG_CANIRQ : integer := 0;
150 constant CFG_CANLOOP : integer := 0;
151 constant CFG_CAN_SYNCRST : integer := 0;
152 constant CFG_CANFT : integer := 0;
153
154 -- UART 1
155 constant CFG_UART1_ENABLE : integer := 1;
156 constant CFG_UART1_FIFO : integer := 1;
157
158 -- LEON3 interrupt controller
159 constant CFG_IRQ3_ENABLE : integer := 1;
160
161 -- Modular timer
162 constant CFG_GPT_ENABLE : integer := 1;
163 constant CFG_GPT_NTIM : integer := (2);
164 constant CFG_GPT_SW : integer := (8);
165 constant CFG_GPT_TW : integer := (32);
166 constant CFG_GPT_IRQ : integer := (8);
167 constant CFG_GPT_SEPIRQ : integer := 1;
168 constant CFG_GPT_WDOGEN : integer := 0;
169 constant CFG_GPT_WDOG : integer := 16#0#;
170
171 -- GPIO port
172 constant CFG_GRGPIO_ENABLE : integer := 1;
173 constant CFG_GRGPIO_IMASK : integer := 16#0000#;
174 constant CFG_GRGPIO_WIDTH : integer := (7);
175
176 -- GRLIB debugging
177 constant CFG_DUART : integer := 0;
178
179
39
180 end;
40 end;
@@ -35,7 +35,11 begin
35 WordClk <= '0';
35 WordClk <= '0';
36 elsif Sclk'event and Sclk = '1' then
36 elsif Sclk'event and Sclk = '1' then
37 if Wcnt = WordSize - 1 then
37 if Wcnt = WordSize - 1 then
38 Cnt_int <= Cnt_int + 1;
38 if Cnt_int = N-1 then
39 Cnt_int <= 0;
40 else
41 Cnt_int <= Cnt_int + 1;
42 end if;
39 Wcnt <= 0;
43 Wcnt <= 0;
40 WordClk <= '1';
44 WordClk <= '1';
41 else
45 else
@@ -29,7 +29,7 port(
29 fifoadr : out std_logic_vector (1 downto 0);
29 fifoadr : out std_logic_vector (1 downto 0);
30
30
31 FULL : out std_logic;
31 FULL : out std_logic;
32 Write : in std_logic;
32 wen : in std_logic;
33 Data : in std_logic_vector(7 downto 0)
33 Data : in std_logic_vector(7 downto 0)
34 );
34 );
35 end FX2_WithFIFO;
35 end FX2_WithFIFO;
@@ -40,18 +40,18 architecture Ar_FX2_WithFIFO of FX2_With
40 type FX2State is (idle);
40 type FX2State is (idle);
41
41
42 Signal USB_DATA : std_logic_vector(7 downto 0);
42 Signal USB_DATA : std_logic_vector(7 downto 0);
43 Signal FIFOwe,FIFOre,FIFOfull : std_logic;
43 Signal FIFOfull : std_logic;
44 Signal USBwe,USBfull,USBempty : std_logic;
44 Signal USBwe,USBfull : std_logic;
45
45
46 begin
46 begin
47
47
48 FULL <= FIFOfull;
48 FULL <= FIFOfull;
49
49
50 FIFO: lpp_fifo
50 --FIFO: lpp_fifo
51 FIFO: FIFO_pipeline
51 generic map(
52 generic map(
52 tech => tech,
53 tech => tech,
53 Mem_use => Mem_use,
54 Mem_use => Mem_use,
54 Enable_ReUse => '0',
55 DataSz => 8,
55 DataSz => 8,
56 abits => 12
56 abits => 12
57 )
57 )
@@ -64,7 +64,7 port map(
64 empty => USBwe,
64 empty => USBwe,
65 raddr => open,
65 raddr => open,
66 wclk => clk,
66 wclk => clk,
67 wen => not Write,
67 wen => wen,
68 wdata => Data,
68 wdata => Data,
69 full => FIFOfull,
69 full => FIFOfull,
70 waddr => open
70 waddr => open
@@ -91,4 +91,3 port map(
91 end ar_FX2_WithFIFO;
91 end ar_FX2_WithFIFO;
92
92
93
93
94
General Comments 0
You need to be logged in to leave comments. Login now