pwmmd.vhd

来自「这个是国外大学的项目代码」· VHDL 代码 · 共 64 行

VHD
64
字号
------------------------------------------------------------------------
--  pwmmd.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 17 logics (pulse widths)), 
-- giving more contrast for the middle values.
------------------------------------------------------------------------

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

entity pwmmd is
    Port ( CLK2X : in std_logic;
           CLK   : in std_logic;
           CLK2  : in std_logic;
           CLK4  : in std_logic;
           DO    : out std_logic;
           DI    : in std_logic_vector(7 downto 0));
end pwmmd;

architecture Behavioral of pwmmd is

begin

    with DI(7 downto 3) select
    DO <= '1'                              when "11111", --16
        '1'                                when "11110", --16
        '1'                                when "11101", --16
        '1'                                when "11100", --16
        CLK4 or CLK2 or CLK or CLK2X       when "11011", --15
        CLK4 or CLK2 or CLK or CLK2X       when "11010", --15
        CLK4 or CLK2 or CLK or CLK2X       when "11001", --15
        CLK4 or CLK2 or CLK                when "11000", --14
        CLK4 or CLK2 or CLK                when "10111", --14
        CLK4 or CLK2 or (CLK and CLK2X)    when "10110", --13
        CLK4 or CLK2 or (CLK and CLK2X)    when "10101", --13
        CLK4 or CLK2                       when "10100", --12
        CLK4 or CLK2                       when "10011", --12
        CLK4 or (CLK2 and (CLK or CLK2X))  when "10010", --11
        CLK4 or (CLK2 and CLK)             when "10001", --10
        CLK4 or (CLK2 and CLK and CLK2X)   when "10000", --09
        CLK4                               when "01111", --08
        CLK4 and (CLK2 or CLK or CLK2X)    when "01110", --07
        CLK4 and (CLK2 or CLK)             when "01101", --06
        CLK4 and (CLK2 or (CLK and CLK2X)) when "01100", --05
        CLK4 and CLK2                      when "01011", --04
        CLK4 and CLK2 and (CLK or CLK2X)   when "01010", --03
        CLK4 and CLK2 and (CLK or CLK2X)   when "01001", --03
        CLK4 and CLK2 and CLK              when "01000", --02
        CLK4 and CLK2 and CLK              when "00111", --02
        CLK4 and CLK2 and CLK and CLK2X    when "00110", --01
        CLK4 and CLK2 and CLK and CLK2X    when "00101", --01
        CLK4 and CLK2 and CLK and CLK2X    when "00100", --01
        '0' when others;

end Behavioral;
                                

⌨️ 快捷键说明

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