@@ -0,0 +1,40 | |||
|
1 | -- Systeme_Clock.vhd | |
|
2 | library IEEE; | |
|
3 | use IEEE.std_logic_1164.all; | |
|
4 | use IEEE.numeric_std.all; | |
|
5 | ||
|
6 | --! Programme qui va permetre de g�n�rer l'horloge systeme (sclk) | |
|
7 | ||
|
8 | entity Systeme_Clock is | |
|
9 | generic(N :integer := 695); --! G�n�rique contenant le r�sultat de la division clk/sclk | |
|
10 | port( | |
|
11 | clk, raz : in std_logic; --! Horloge et Reset globale | |
|
12 | sclk : out std_logic --! Horloge Systeme g�n�r�e | |
|
13 | ); | |
|
14 | end Systeme_Clock; | |
|
15 | ||
|
16 | --! @details Fonctionne a base d'un compteur (countint) qui va permetre de diviser l'horloge N fois | |
|
17 | architecture ar_Systeme_Clock of Systeme_Clock is | |
|
18 | ||
|
19 | signal clockint : std_logic; | |
|
20 | signal countint : integer range 0 to N/2-1; | |
|
21 | ||
|
22 | begin | |
|
23 | process (clk,raz) | |
|
24 | begin | |
|
25 | if(raz = '0') then | |
|
26 | countint <= 0; | |
|
27 | clockint <= '0'; | |
|
28 | elsif (clk' event and clk='1') then | |
|
29 | if (countint = N/2-1) then | |
|
30 | countint <= 0; | |
|
31 | clockint <= not clockint; | |
|
32 | else | |
|
33 | countint <= countint+1; | |
|
34 | end if; | |
|
35 | end if; | |
|
36 | end process; | |
|
37 | ||
|
38 | sclk <= clockint; | |
|
39 | ||
|
40 | end ar_Systeme_Clock; No newline at end of file |
@@ -60,6 +60,7 type LEDregs is record | |||
|
60 | 60 | end record; |
|
61 | 61 | |
|
62 | 62 | signal r : LEDregs; |
|
63 | signal Rdata : std_logic_vector(31 downto 0); | |
|
63 | 64 | |
|
64 | 65 | |
|
65 | 66 | begin |
@@ -71,7 +72,7 begin | |||
|
71 | 72 | if rst = '0' then |
|
72 | 73 | LED <= "000"; |
|
73 | 74 | r.DATAin <= (others => '0'); |
|
74 | apbo.prdata <= (others => '0'); | |
|
75 | ||
|
75 | 76 |
|
|
76 | 77 | |
|
77 | 78 | LED <= r.DATAin(2 downto 0); |
@@ -87,12 +88,12 begin | |||
|
87 | 88 | end if; |
|
88 | 89 | |
|
89 | 90 | --APB READ OP |
|
90 |
if (apbi.psel(pindex) |
|
|
91 | if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then | |
|
91 | 92 | case apbi.paddr(abits-1 downto 2) is |
|
92 | 93 | when "000000" => |
|
93 |
|
|
|
94 | Rdata <= r.DATAin; | |
|
94 | 95 | when others => |
|
95 |
|
|
|
96 | Rdata <= r.DATAout; | |
|
96 | 97 | end case; |
|
97 | 98 | end if; |
|
98 | 99 | |
@@ -100,5 +101,5 begin | |||
|
100 | 101 | apbo.pconfig <= pconfig; |
|
101 | 102 | end process; |
|
102 | 103 | |
|
103 | ||
|
104 | apbo.prdata <= Rdata when apbi.penable = '1'; | |
|
104 | 105 | end ar_APB_MULTI_DIODE; |
@@ -60,7 +60,7 type LEDregs is record | |||
|
60 | 60 | end record; |
|
61 | 61 | |
|
62 | 62 | signal r : LEDregs; |
|
63 | ||
|
63 | signal Rdata : std_logic_vector(31 downto 0); | |
|
64 | 64 | |
|
65 | 65 | begin |
|
66 | 66 | |
@@ -71,7 +71,7 begin | |||
|
71 | 71 | if rst = '0' then |
|
72 | 72 | LED <= '0'; |
|
73 | 73 | r.DATAin <= (others => '0'); |
|
74 | apbo.prdata <= (others => '0'); | |
|
74 | ||
|
75 | 75 |
|
|
76 | 76 | |
|
77 | 77 | LED <= r.DATAin(0); |
@@ -87,12 +87,12 begin | |||
|
87 | 87 | end if; |
|
88 | 88 | |
|
89 | 89 | --APB READ OP |
|
90 |
if (apbi.psel(pindex) |
|
|
90 | if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then | |
|
91 | 91 | case apbi.paddr(abits-1 downto 2) is |
|
92 | 92 | when "000000" => |
|
93 |
|
|
|
93 | Rdata <= r.DATAin; | |
|
94 | 94 | when others => |
|
95 |
|
|
|
95 | Rdata <= r.DATAout; | |
|
96 | 96 | end case; |
|
97 | 97 | end if; |
|
98 | 98 | |
@@ -100,7 +100,7 begin | |||
|
100 | 100 | apbo.pconfig <= pconfig; |
|
101 | 101 | end process; |
|
102 | 102 | |
|
103 | ||
|
103 | apbo.prdata <= Rdata when apbi.penable = '1'; | |
|
104 | 104 | |
|
105 | 105 | -- pragma translate_off |
|
106 | 106 | -- bootmsg : report_version |
@@ -44,7 +44,7 CLKINT_1 : CLKINT | |||
|
44 | 44 | port map(A => rst, Y => raz); |
|
45 | 45 | |
|
46 | 46 | |
|
47 |
SystemCLK : entity work.Clock |
|
|
47 | SystemCLK : entity work.Systeme_Clock | |
|
48 | 48 | generic map (nb_serial) |
|
49 | 49 | port map (clk,raz,s_SCLK); |
|
50 | 50 |
@@ -46,7 +46,7 component CNA_TabloC is | |||
|
46 | 46 | end component; |
|
47 | 47 | |
|
48 | 48 | |
|
49 |
component Clock |
|
|
49 | component Systeme_Clock is | |
|
50 | 50 | generic(N :integer := 695); |
|
51 | 51 | port( |
|
52 | 52 | clk, raz : in std_logic ; |
@@ -67,6 +67,7 type UART_ctrlr_Reg is record | |||
|
67 | 67 | end record; |
|
68 | 68 | |
|
69 | 69 | signal Rec : UART_ctrlr_Reg; |
|
70 | signal Rdata : std_logic_vector(31 downto 0); | |
|
70 | 71 | |
|
71 | 72 | begin |
|
72 | 73 | |
@@ -86,7 +87,7 Rec.UART_Cfg(4) <= NwData; | |||
|
86 | 87 | begin |
|
87 | 88 | if(rst='0')then |
|
88 | 89 | Rec.UART_Wdata <= (others => '0'); |
|
89 | apbo.prdata <= (others => '0'); | |
|
90 | ||
|
90 | 91 |
|
|
91 | 92 |
|
|
92 | 93 | |
@@ -104,18 +105,18 Rec.UART_Cfg(4) <= NwData; | |||
|
104 | 105 | end if; |
|
105 | 106 | |
|
106 | 107 | --APB READ OP |
|
107 |
if (apbi.psel(pindex) |
|
|
108 | if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then | |
|
108 | 109 | case apbi.paddr(abits-1 downto 2) is |
|
109 | 110 | when "000000" => |
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
111 | Rdata(31 downto 27) <= Rec.UART_Cfg; | |
|
112 | Rdata(26 downto 12) <= (others => '0'); | |
|
113 | Rdata(11 downto 0) <= Rec.UART_BTrig; | |
|
113 | 114 | when "000001" => |
|
114 |
|
|
|
115 | Rdata(7 downto 0) <= Rec.UART_Wdata; | |
|
115 | 116 | when "000010" => |
|
116 |
|
|
|
117 | Rdata(7 downto 0) <= Rec.UART_Rdata; | |
|
117 | 118 | when others => |
|
118 |
|
|
|
119 | Rdata <= (others => '0'); | |
|
119 | 120 | end case; |
|
120 | 121 | end if; |
|
121 | 122 | |
@@ -123,4 +124,6 Rec.UART_Cfg(4) <= NwData; | |||
|
123 | 124 | apbo.pconfig <= pconfig; |
|
124 | 125 | end process; |
|
125 | 126 | |
|
127 | apbo.prdata <= Rdata when apbi.penable = '1'; | |
|
128 | ||
|
126 | 129 | end ar_APB_UART; |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now