pwmhi.vhd

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

VHD
62
字号
------------------------------------------------------------------------
--  pwmhi.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 greater values.
------------------------------------------------------------------------

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

entity pwmhi 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 pwmhi;
architecture Behavioral of pwmhi is

begin

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

end Behavioral;
                                

⌨️ 快捷键说明

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