source: FPGA/FAD/FACT_FAD_test_devices_lib/max6662_emulator_beha.vhd@ 236

Last change on this file since 236 was 215, checked in by dneise, 16 years ago
initial commit (2nd part): only VHDL and UCF files were commited.
  • Property svn:executable set to *
File size: 1.5 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 );
26END max6662_emulator ;
27
28ARCHITECTURE beha OF max6662_emulator IS
29
30 signal data : std_logic_vector(15 downto 0) := (others => '0');
31 signal spi_cycle_cnt : integer := 0;
32 signal temperature : integer range -55 to 150 := DRS_TEMPERATURE;
33
34BEGIN
35
36 spi_cnt_proc: process (sclk)
37 begin
38 if rising_edge(sclk) then
39 if (sensor_cs /= "1111") then
40 spi_cycle_cnt <= spi_cycle_cnt + 1;
41 else
42 spi_cycle_cnt <= 0;
43 end if;
44 end if;
45 end process spi_cnt_proc;
46
47 sensor_data_proc: process (spi_cycle_cnt, sclk)
48 begin
49 if falling_edge(sclk) then
50 sio <= 'Z';
51 if (spi_cycle_cnt = 1) then
52 data <= '0' & conv_std_logic_vector(temperature + conv_integer(sensor_cs), 12) & "000";
53 end if;
54 if (spi_cycle_cnt > 7) then
55 sio <= data(15);
56 data(15 downto 1) <= data(14 downto 0);
57 end if;
58 end if;
59 end process sensor_data_proc;
60
61END ARCHITECTURE beha;
62
Note: See TracBrowser for help on using the repository browser.