summaryrefslogtreecommitdiff
path: root/Examples/Mixed_Mode/custom_mixed_mode/customblock.vhdl
diff options
context:
space:
mode:
authorRahul P2020-04-09 18:36:19 +0530
committerGitHub2020-04-09 18:36:19 +0530
commit6a0ef73be748b4e885d4288dede37fc76ad95158 (patch)
treeabf923d3c1559d26fc2324e53b2711907f433db9 /Examples/Mixed_Mode/custom_mixed_mode/customblock.vhdl
parent71d2ee1a0984569bd4069c953422144c3ce8f29b (diff)
parent26db6439a3038b92d23ade0a2bcf37ba57c87f7b (diff)
downloadeSim-6a0ef73be748b4e885d4288dede37fc76ad95158.tar.gz
eSim-6a0ef73be748b4e885d4288dede37fc76ad95158.tar.bz2
eSim-6a0ef73be748b4e885d4288dede37fc76ad95158.zip
Merge pull request #149 from rahulp13/master
resolved issues with rename and refresh projects, empty path
Diffstat (limited to 'Examples/Mixed_Mode/custom_mixed_mode/customblock.vhdl')
-rw-r--r--Examples/Mixed_Mode/custom_mixed_mode/customblock.vhdl43
1 files changed, 43 insertions, 0 deletions
diff --git a/Examples/Mixed_Mode/custom_mixed_mode/customblock.vhdl b/Examples/Mixed_Mode/custom_mixed_mode/customblock.vhdl
new file mode 100644
index 00000000..afe2c4dd
--- /dev/null
+++ b/Examples/Mixed_Mode/custom_mixed_mode/customblock.vhdl
@@ -0,0 +1,43 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity customblock is
+port(C : in std_logic;
+ D : in std_logic;
+ Q : out std_logic);
+end customblock;
+
+
+architecture bhv of customblock is
+ signal count: integer:=1; --counts number of CLOCK cycles
+ signal period: integer:=10; --PWM signal period is 10 times of clock period
+ signal boost : integer:=9; --number of clock pulses during T_ON
+ signal buck : integer:=1; --number of clock pulses during T_OFF
+begin
+ process (C,D)
+
+ begin
+
+ if(C='1' and C'event) then
+ count<=count+1;
+ if(count=period)then -- resets count for period
+ count<=1;
+ end if;
+ if(D='1') then --boost duty cycle when compartor output is high--
+ if(count<=boost)then
+ Q<='1';
+ elsif(count>boost) then
+ Q<='0';
+ end if;
+ end if;
+ if(D='0')then --buck duty cycle when compartor output is low--
+ if(count<=buck)then --
+ Q<='1';
+ elsif(count>buck)then
+ Q<='0';
+ end if;
+ end if;
+ end if;
+ end process;
+end bhv;