led_m8.vhd

来自「Lattice 超精简8位软核CPU--Mico8」· VHDL 代码 · 共 92 行

VHD
92
字号
-----------------------------------------------------------------------
-- LED_M8.vhd
-- --------------------------------------------------------------------
-- >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
-- --------------------------------------------------------------------
-- Copyright (c) 2005 by Lattice Semiconductor Corporation
-- --------------------------------------------------------------------
--
-- Permission:
--
--   Lattice Semiconductor grants permission to use this code for use
--   in synthesis for any Lattice programmable logic product.  Other
--   use of this code, including the selling or duplication of any
--   portion is strictly prohibited.
--
-- Disclaimer:
--
--   This VHDL or Verilog source code is intended as a design reference
--   which illustrates how these types of functions can be implemented.
--   It is the user's responsibility to verify their design for
--   consistency and functionality through the use of formal
--   verification methods.  Lattice Semiconductor provides no warranty
--   regarding the use or functionality of this code.
--
-- --------------------------------------------------------------------
--           
--                     Lattice Semiconductor Corporation
--                     5555 NE Moore Court
--                     Hillsboro, OR 97214
--                     U.S.A
--
--                     TEL: 1-800-Lattice (USA and Canada)
--                          408-826-6000 (other locations)
--
--                     web: http://www.latticesemi.com/
--                     email: techsupport@latticesemi.com
--
-- --------------------------------------------------------------------
--
-- This is a Mico8 peripheral that controls 8 LED's
-- Address map:
-- 00000111: LED control register
-- --------------------------------------------------------------------
--
-- Revision History :
-- --------------------------------------------------------------------
--   Ver  :| Author            :| Mod. Date :| Changes Made:
--   V1.1 :| G.M.              :| 13/03/08  :| Release
-- --------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity led_M8 is
port (
	Clk : in std_logic;
	Reset : in std_logic;
	WR : in std_logic;
	Addr: in std_logic_vector(7 downto 0);
	Mico8_Data : in std_logic_vector (7 downto 0);
	LEDs_Out: out std_logic_vector(7 downto 0)
	);
end led_M8;

architecture behave of led_M8 is

signal zWR : std_logic;
constant LEDaddress: std_logic_vector (7 downto 0) := "00000111";

attribute pgroup : string;
attribute pgroup of behave : architecture is "LED";

begin

write: process (clk, reset, WR)
begin
	if reset = '1' then
		Leds_out <= (others => '0');
		zWR <= WR;
	elsif clk'event and clk = '1' then
		zWR <= WR;
		if (zWR /= WR) and (WR = '0') then
			if Addr = LEDaddress then
				Leds_out <= Mico8_Data(7 downto 0);
			end if;
		end if;
	end if;
end process;

	
end behave;

⌨️ 快捷键说明

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