vhdl程序 帮忙看一下 挑挑错

来源:百度知道 编辑:UC知道 时间:2024/05/25 00:11:45
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY mux4 IS
PORT (clk:in std_logic;
s1:buffer std_logic;
s2, s3, s4, s5:out std_logic);
END mux4
ARCHITECYURE body_mux4 OF mux4 IS
BEGIN
s3: PROCESS
BEGIN
clk'event and clk='1' then
if counter=17 then
s3<=not s3
counter<=counter+1
elsif counter=23 then
s3<=not s3
counter<=0
else
counter<=counter+1;
END PROCESS;

S5: PROCESS
BEGIN
clk'event and clk='1' then
if counter=11 then
s5<=not s5
counter<=counter+1
elsif counter=29 then
s5<=not s5
counter<=0
else
counter<=counter+1;
END IF;
END PROCESS;

S2: PROCESS
BEGIN
clk'event and clk='1' then
if counter=17 then
s2<=not s2
counter<=counter+1
elsif counter=23 then
s2<=not s2
counter<=0

process的标号不允许和signal重名
信号counter没有声明
类似s3<=not s3这样的语句也是不合法的,输出端口不能出现在表达式右端
process没有敏感信号表
应当在开头写上USE IEEE.STD_LOGIC_UNSIGNED.ALL 因为对std_logic类型进行了算数运算,而std_logic_1164不包含这种运算
条件判断clk'event and clk='1'缺少了if和end if
最后end architecture语句应当写成结构体名body_mux4而不是实体名MUX4
当然咯,很多行都没有分号