source: firmware/FAD/FACT_FAD_TB_lib/hdl/max6662_emulator_beha.vhd@ 18459

Last change on this file since 18459 was 11755, checked in by neise, 13 years ago
reinit of this svn repos .... it was all too messy deleted the old folders and restarted with FACT_FAD_lib only. (well and the testbenches)
File size: 1.6 KB
Line 
1--
2-- VHDL Architecture FACT_FAD_TB_lib.spi_devices_emulator.beha
3--
4-- Created:
5-- by - Benjamin Krumm.UNKNOWN (EEPC8)
6-- at - 09:26:11 28.04.2010
7--
8-- using Mentor Graphics HDL Designer(TM) 2009.1 (Build 12)
9--
10LIBRARY ieee;
11USE ieee.std_logic_1164.all;
12USE ieee.std_logic_arith.all;
13USE ieee.std_logic_unsigned.all;
14LIBRARY FACT_FAD_lib;
15USE FACT_FAD_lib.fad_definitions.all;
16
17ENTITY max6662_emulator IS
18 GENERIC(
19 DRS_TEMPERATURE : integer := 51
20 );
21 PORT(
22 sclk : in std_logic;
23 sio : inout std_logic;
24 sensor_cs : in std_logic_vector (3 DOWNTO 0)
25 );
26
27-- Declarations
28
29END max6662_emulator ;
30
31ARCHITECTURE beha OF max6662_emulator IS
32
33 signal data : std_logic_vector(15 downto 0) := (others => '0');
34 signal spi_cycle_cnt : integer := 0;
35 signal temperature : integer range -55 to 150 := DRS_TEMPERATURE;
36
37BEGIN
38 sio <= 'Z';
39 spi_cnt_proc: process (sclk)
40 begin
41 if rising_edge(sclk) then
42 if (sensor_cs /= "1111") then
43 spi_cycle_cnt <= spi_cycle_cnt + 1;
44 else
45 spi_cycle_cnt <= 0;
46 end if;
47 end if;
48 end process spi_cnt_proc;
49
50 sensor_data_proc: process (spi_cycle_cnt, sclk)
51 begin
52 if falling_edge(sclk) then
53 sio <= 'Z';
54 if (spi_cycle_cnt = 1) then
55 --data <= '0' & conv_std_logic_vector(temperature + conv_integer(sensor_cs), 12) & "000";
56 data <= X"A059";
57 end if;
58 if (spi_cycle_cnt > 7) then
59 --sio <= data(15);
60 data(15 downto 1) <= data(14 downto 0);
61 end if;
62 end if;
63 end process sensor_data_proc;
64
65END ARCHITECTURE beha;
66
Note: See TracBrowser for help on using the repository browser.