⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwm2x.vhd

📁 这个是国外大学的项目代码
💻 VHD
字号:
------------------------------------------------------------------------
--  pwm2x.vhd -- Pulse Width Modulator
------------------------------------------------------------------------
--  Author : Kovacs Laszlo - Attila 
------------------------------------------------------------------------
-- Software version: Xilinx ISE 7.1.04i
--                   WebPack
------------------------------------------------------------------------
-- This Pulse Width Modulator according to the 5 most significant bits 
-- of the data input selects one of the 32 logics (pulse widths).
------------------------------------------------------------------------

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity pwm2x is
    Port ( CLK2X : in std_logic;
           CLK   : in std_logic;
           CLK2  : in std_logic;
           CLK4  : in std_logic;
           CLK8  : in std_logic;
           DO    : out std_logic;
           DI    : in std_logic_vector(7 downto 0));
end pwm2x;
architecture Behavioral of pwm2x is

begin

    with DI(7 downto 3) select
    DO <= '1'                                       when "11111",--32
        CLK8 or CLK4 or CLK2 or CLK or CLK2X        when "11110",--31
        CLK8 or CLK4 or CLK2 or CLK                 when "11101",--30
        CLK8 or CLK4 or CLK2 or (CLK and CLK2X)     when "11100",--29
        CLK8 or CLK4 or CLK2                        when "11011",--28
        CLK8 or CLK4 or (CLK2 and (CLK or CLK2X))   when "11010",--27
        CLK8 or CLK4 or (CLK2 and CLK)              when "11001",--26
        CLK8 or CLK4 or (CLK2 and CLK and CLK2X)    when "11000",--25
        CLK8 or CLK4                                when "10111",--24
        CLK8 or (CLK4 and (CLK2 or CLK or CLK2X))   when "10110",--23
        CLK8 or (CLK4 and (CLK2 or CLK))            when "10101",--22
        CLK8 or (CLK4 and (CLK2 or (CLK and CLK2X)))when "10100",--21
        CLK8 or (CLK4 and CLK2)                     when "10011",--20
        CLK8 or (CLK4 and CLK2 and (CLK or CLK2X))  when "10010",--19
        CLK8 or (CLK4 and CLK2 and CLK)             when "10001",--18
        CLK8 or (CLK4 and CLK2 and CLK and CLK2X)   when "10000",--17
        CLK8                                        when "01111",--16
        CLK8 and (CLK4 or CLK2 or CLK or CLK2X)     when "01110",--15
        CLK8 and (CLK4 or CLK2 or CLK)              when "01101",--14
        CLK8 and (CLK4 or CLK2 or (CLK and CLK2X))  when "01100",--13
        CLK8 and (CLK4 or CLK2)                     when "01011",--12
        CLK8 and (CLK4 or (CLK2 and (CLK or CLK2X)))when "01010",--11
        CLK8 and (CLK4 or (CLK2 and CLK))           when "01001",--10
        CLK8 and (CLK4 or (CLK2 and CLK and CLK2X)) when "01000",--09
        CLK8 and CLK4                               when "00111",--08
        CLK8 and CLK4 and (CLK2 or CLK or CLK2X)    when "00110",--07
        CLK8 and CLK4 and (CLK2 or CLK)             when "00101",--06
        CLK8 and CLK4 and (CLK2 or (CLK and CLK2X)) when "00100",--05
        CLK8 and CLK4 and CLK2                      when "00011",--04
        CLK8 and CLK4 and CLK2 and not CLK          when "00010",--03
        CLK8 and CLK4 and CLK2 and CLK2X            when "00001",--01
        '0'                                         when others; --00

end Behavioral;
                                          

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -