summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/bascule/bascule.vhd
blob: c17fe8fd785988969bf318f6ca319de5e607b245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
-- bascule.vhd
-- Eurobot 2004 : APB Team
-- Auteur : Pierre-Andr� Galmes
-- Bascule 8 bits avec signal de d�tection des changements.

-- Remarque : 
-- masque : si bit � 1 => on d�tecte l'interruption.
-- 	    si bit � 0 => on d�tecte pas l'interruption.


library ieee;
use	ieee.std_logic_1164.all;
--use     ieee.std_logic_arith.all;
--use     ieee.std_logic_unsigned.all;

use	work.isa_const.all;
use	work.nono_const.all;


entity bascule is
    port (
	clk : in std_logic;
	rst : in std_logic;
	data_in : in T_DATA;
	data_out : out T_DATA;
	it_detected : out std_logic
    );
end entity;

architecture RTL of bascule is
begin
    -- process s�quentiel
    process (rst, clk)
    begin
	if (rst = '1') then
	    -- ne pas d�clencher d'it apr�s rst.
	    data_out <= x"00"; 
	    it_detected <= '0';
	elsif (clk'event and clk = '1') then
	
	    -- TODO : ici c'est s�quentiel. On peut le faire en combinatiore ?
	    if (data_in(0) = '1') then data_out(0) <= '1'; end if;
	    if (data_in(1) = '1') then data_out(1) <= '1'; end if;
	    if (data_in(2) = '1') then data_out(2) <= '1'; end if;
	    if (data_in(3) = '1') then data_out(3) <= '1'; end if;
	    if (data_in(4) = '1') then data_out(4) <= '1'; end if;
	    if (data_in(5) = '1') then data_out(5) <= '1'; end if;
	    if (data_in(6) = '1') then data_out(6) <= '1'; end if;
	    if (data_in(7) = '1') then data_out(7) <= '1'; end if;

	    -- D�tection des interruptions.
	    if (data_in /= x"00") then it_detected <= '1'; end if;
	end if;
    end process;
    
-- TODO : modifier et mettre en concurentiel cette partie (la c'est en
-- s�quentiel !!!)
    
--      data_out(0) <= '1' when (data_in(0) = '1');
--      data_out(1) <= '1' when (data_in(1) = '1');
--      data_out(2) <= '1' when (data_in(2) = '1');
--      data_out(3) <= '1' when (data_in(3) = '1');
--      data_out(4) <= '1' when (data_in(4) = '1');
--      data_out(5) <= '1' when (data_in(5) = '1');
--      data_out(6) <= '1' when (data_in(6) = '1');
--      data_out(7) <= '1' when (data_in(7) = '1');

end RTL;