UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor bmn1234
Visitor
3,800 Views
Registered: ‎06-25-2012

Please Help Me!! It's really very important !!

Hi All,

 

I'm new at VHDL.

 

And i have to create a Testbench for the following module til tomorrow. If not i can't take the exam. Please help me :(

 

 

 

 

 

 

-------------------------------------------------------
--! @file asha-regelung.vhd
--! @brief ASHA-Modul - Regelung
--! @details Dieses Modul enthaelt die Regelung
--! @author Michael Heide
--! @date 15.04.2012
--! @version 0.10
-------------------------------------------------------

--! Standardbibliothek benutzen
library IEEE;

--! Logikelemente verwenden
use IEEE.STD_LOGIC_1164.ALL;

--! Numerisches Rechnen ermoeglichen
use IEEE.NUMERIC_STD.ALL;

--! @brief ASHA-Modul - Regelung
--! @details Dieses Modul enthaelt die Regelung
entity AshaRegelung is
Port (
Clock : in std_logic; --! Taktsignal
SevenSegmentValue : in std_logic_vector (15 downto 0); --! der Wert, der auf der Anzeige erscheinen soll
Reset : in std_logic; --! Resetsignal
EnClockLight : in std_logic; --! Enable-Signal fuer die Lichtregelung
EnClockTemp : in std_logic; --! Enable-Signal fuer die Temperaturregelung
SensordataTemp : in std_logic_vector(11 downto 0); --! Aktuelle Temperatur
ControlLightTarget : unsigned(11 downto 0); --! Sollwert Helligkeit
ControlTempTarget : unsigned(11 downto 0); --! Sollwert Temperatur
PWM4PeltierValueControlOut : out std_logic_vector(7 downto 0); --! PWM-Wert Peltier
PeltierDirectionControl : out std_logic; --! Richtung heizen/kuehlen
ControlLightDiffOut : out unsigned(12 downto 0); --! Aktuelle Regeldifferenz Licht
ControlTempDiffOut : out unsigned(12 downto 0); --! Aktuelle Regeldifferenz Temperatur
PWM1FanInsideValueControl : out std_logic_vector(7 downto 0); --! PWM-Wert innerere Luefter
PWM2FanOutsideValueControl : out std_logic_vector(7 downto 0);
SensordataLight : in std_logic_vector(11 downto 0); --! Aktuelle Lichtwerte
PWM3LightValueControlOut : out std_logic_vector(7 downto 0) --! PWM-Wert Licht
); --! PWM-Wert aeusserer Luefter
end AshaRegelung;

architecture Behavioral of AshaRegelung is
signal ControllTempDiff : unsigned(12 downto 0);
signal ControllLightDiff : unsigned(12 downto 0);

Begin
process(SensordataLight)
begin

-- in Versuch 7/8 zu implementieren!

if (SensordataLight < "111111010001") then -- 10Lux entspricht dem Wert: 40913, Abfrage ob der Lichtwert geringer als 10Lux ist
PWM3LightValueControlOut <="11111111"; -- Counterwert 255, entspricht 100% helligkeit
end if;
if (SensordataLight < "111100111111" -- 50Lux entspricht dem Wert: 40767, Abfrage ob der Lichtwert zwischen 10 und 50 Lux liegt
) then
PWM3LightValueControlOut <="01111111"; -- Counterwert 127, entspricht 50% helligkeit
end if;
if (SensordataLight >= "110100010111") then -- 200Lux entspricht dem Wert: 40218, Abfrage ob der Lichtwert höher als 200Lux ist
PWM3LightValueControlOut <="00000000"; -- Counterwert 0, entspricht 0% helligkeit (LED aus)
end if;
------------Testbench has simulate after this line-----------------------
PWM4PeltierValueControlOut <=(others=>'0'); --! PWM-Wert Peltier
PeltierDirectionControl <='0'; --! Richtung heizen/kuehlen
ControlLightDiffOut <=(others=>'0'); --! Aktuelle Regeldifferenz Licht
ControlTempDiffOut <=(others=>'0'); --! Aktuelle Regeldifferenz Temperatur
PWM1FanInsideValueControl <=(others=>'0'); --! PWM-Wert innerere Luefter
PWM2FanOutsideValueControl <=(others=>'0'); --! PWM-Wert aeusserer Luefter

----------------------------
ControllTempDiff <= ('1' &ControlTempTarget - ('0' & unsigned(SensordataTemp)) );
ControllLightDiff <= ('1' &ControlLightTarget- ('0' & unsigned(SensordataLight)) ) ;
-------------
ControlLightDiffOut <= ControllLightDiff ;
ControlTempDiffOut <= ControllTempDiff;
------------------------------
if(to_integer(ControllTempDiff) = 0) then
PeltierDirectionControl <='0';
PWM1FanInsideValueControl <=(others=>'1');
end if;
if(to_integer(ControllTempDiff) = 8191) then
PeltierDirectionControl <='1';
PWM1FanInsideValueControl <=(others=>'1');
else
PWM1FanInsideValueControl <=(others=>'0');
end if;
------------------------------
if(to_integer(ControllLightDiff) = 0) then
PWM3LightValueControlOut <="11111111";--PWM3LightValueControlOut <='1';
end if;
if(to_integer(ControllLightDiff) = 8191) then
PWM3LightValueControlOut <="00000000"; --PWM3LightValueControlOut <='0';
end if;










--if Switches = "01010101" then SevenSegmentValue <= ControlLightDiffOut;
--End if; if Switches = "10101010" then SevenSegmentValue <= ControlTempDiffOut; end if;

 

 

 

 

 


--if (Switches = "00000100" AND )then SevenSegmentValue <= "0000 0000 0000 0001"; End if;
--if (Switches = "00000100" AND )then SevenSegmentValue <= "0000 0000 0000 0010";
--; End if; if (Switches = "00000100" AND "0000 0000 0000 0010";)then SevenSegmentValue <= "0000 0000 0000 0100";
--End if;

end process;
end Behavioral;

0 Kudos
2 Replies
Visitor bmn1234
Visitor
3,767 Views
Registered: ‎06-25-2012

Re: Please Help Me!! It's really very important !!

Pleaseeeeee :(
0 Kudos
Xilinx Employee
Xilinx Employee
3,757 Views
Registered: ‎01-03-2008

Re: Please Help Me!! It's really very important !!

There are two problems with your post. The first is that this is obviously school work and most users in the forum are reluctant to provide direct solutions as it does not help with learning process and is considered helping someone to cheat. The second is that you have not provide enough information to allow anyone to provide guidance to help you create the testbench that the assignment calls for.
------Have you tried typing your question into Google? If not you should before posting.
Too many results? Try adding site:www.xilinx.com