麻烦各位大神帮我看看。
----------------------------------------------------------------------------------
--Project3 --Toplevel.vhd --Boyuan Chen --12.11.14
-- top level
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Toplevel is
port (SW : in std_logic_vector(3 downto 0);
Clock : in std_logic;
Reset : in std_logic;
DY : in std_logic_vector(3 downto 0);
addx : out std_logic_vector(3 downto 0);
LED : out std_logic_vector(3 downto 0));
end Toplevel;
architecture Behavioral of Toplevel is
signal clk_temp : std_logic;
component Microcode is
port (SW : in std_logic_vector(3 downto 0);
Clock : in std_logic;
Reset : in std_logic;
DY : in std_logic_vector(3 downto 0);
addx : out std_logic_vector(3 downto 0);
LED : out std_logic_vector(3 downto 0));
end component;
component clockdiv is
Generic (NN :integer :=1 );
Port (clkin,clr : in STD_LOGIC;
clkout : out STD_LOGIC);
end component;
begin
U1: Microcode port map(SW=>SW, Clock=>clk_temp, reset=>reset,
DY=>DY, addx=>addx, LED=>LED);
U2: ClockDiv port map(clkin=>clock, clr=>reset, clkout=>clk_temp);
end Behavioral;
这是我的顶层
此帖出自
小平头技术问答
--ClkWork --ClockDiv.vhd --boyuan chen --11.16.14
--2Hz Clock
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity ClockDiv is
Generic (NN :integer :=12500000 );
Port ( clkin,clr : in STD_LOGIC;
clkout : out STD_LOGIC);
end ClockDiv;
architecture Behavioral of ClockDiv is
signal cnt : integer range 0 to NN-1;
signal clk : std_logic :='1';
begin
process(clkin,clr)
begin
if clr='1' then
cnt<=0; clk<='1';
elsif clkin'event and clkin='1' then
if cnt =NN-1 then
cnt<=0; clk<= not clk;
else
cnt<=cnt+1;
end if;
end if;
end process;
clkout <= clk;
end Behavioral;
一周热门 更多>