vhdl程序翻译

来源:百度知道 编辑:UC知道 时间:2024/05/18 14:47:06
帮忙翻译下程序,程序可能没贴完,最好能留下QQ,好的话再加分。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity top is
Port(clk32MHz: in std_logic;
handtoauto: in std_logic;
code1: out std_logic_vector(6 downto 0);
index1: in std_logic_vector(7 downto 0);
high1: out std_logic;
spkout: out std_logic);
end;
architecture Behavioral of top is
component automusic
Port(clk: in std_logic;
Auto: in std_logic;
index2: in std_logic_vector(7 downto 0);
index0: out std_logic_vector(7 downto 0));
end component;
component tone
Port(index: in std_logic_vector(7 downto 0);
code: out std_logi

你的程序没粘贴完;
我只能给你解释一下,在你的程序中你首先定义了一个实体top,他拥有一个

32mhz的时钟输入口,一个单输入口handletoauto,一个7位向量输出口code1,以

及8位的向量输入口index1,单输出口high1和spkout,这些都是的卢的外部端口

。而后又定义了top的结构体behavior,他是反应top的内部结构的,在这其中又

调用了automusic组件,他是你在后面定义的一个实体,后面的component tone,

component speaker,也是和 automusic一样,signal tone2是一个整形信号变量

它的范围是从0到2047,接下来u0是将automusic组件的各个端口信号从左到右进

行一次映像,即将automusic的各端口值传送给top的外端口clk32MHZ,index1,

indx,handtoauto,u1,u2也是同样的意思。而在下面你就是定义了一个tone实

体,就是你上面调用的tone组件的实体,对应的端口定义就不解释了,我直接给

你分析process进程吧:它相当于一个无限循环,每次循环事都探测index信号,
当index取when后面的条件值时,那么tone0,code,high获得相应的赋值,当

index取值不是when后面的值时,那么执行when others。其实这很简单的,你仔细揣摩很容易。