diff options
author | Rahul P | 2020-08-08 19:16:28 +0530 |
---|---|---|
committer | GitHub | 2020-08-08 19:16:28 +0530 |
commit | 8255c72075ab3541e8b6cfa7facb4e016157a905 (patch) | |
tree | e86226cc6a609e54133b527ad71912996360722b /Examples/Mixed_Signal/custom_mixed_signal/customblock.vhdl | |
parent | 175208c2553bde875968a9bc53176b6039ba9360 (diff) | |
parent | 7871e58975d75eb2b02928f7a48d29113bebeb2b (diff) | |
download | eSim-8255c72075ab3541e8b6cfa7facb4e016157a905.tar.gz eSim-8255c72075ab3541e8b6cfa7facb4e016157a905.tar.bz2 eSim-8255c72075ab3541e8b6cfa7facb4e016157a905.zip |
Merge pull request #156 from rahulp13/master
ported GUI to PyQt5; platform independent paths; launch ngspice through mintty on Win OS
Diffstat (limited to 'Examples/Mixed_Signal/custom_mixed_signal/customblock.vhdl')
-rw-r--r-- | Examples/Mixed_Signal/custom_mixed_signal/customblock.vhdl | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Examples/Mixed_Signal/custom_mixed_signal/customblock.vhdl b/Examples/Mixed_Signal/custom_mixed_signal/customblock.vhdl new file mode 100644 index 00000000..afe2c4dd --- /dev/null +++ b/Examples/Mixed_Signal/custom_mixed_signal/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; |