集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 2715|回复: 3

求助啊求助!!!我用quartus编VHDL遇到的问题!!!

[复制链接]
z2642x 发表于 2010-10-14 21:37:12 | 显示全部楼层 |阅读模式
本帖最后由 z2642x 于 2010-10-14 21:40 编辑

我用quartus II 编了一个简单的数据通路实验
有两个VHDL编的器件,第一个里面含有程序计数器pc,地址寄存器ar,输入输出用总线,然后外接一个储存器,将这几部分打包成一个器件.
第二个里面含有运算单元alu,就是两个74181的组合,用vhdl写了一遍;两个触发器r1r2用来给alu提供运算数据;两个寄存器r4r5储存运算的中间结果.
在波形仿真验证的时候有一个问题,就是我无法将第一个器件中的储存器的某个数值读出来储存在第二个器件中的寄存器或者触发器中.
改了很多地方也改不对!
有没有大神能帮帮忙啊!!!求救!!!
第一个器件代码如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity VScpu is
port(  clk_cdu,pcclr,pcld,pcen   :in std_logic;
           sw_bus,pc_bus,ldar     :in std_logic;
           inputd  :in    std_logic_vector(7 downto 0);
           arout   ut   std_logic_vector(7 downto 0);
           d      :inout  std_logic_vector(7 downto 0) );
end VScpu;
architecture rtl of VScpu is
signal pc,ar,bus_reg:std_logic_vector(7 downto 0);
begin
seq1:process(clk_cdu,ldar,bus_reg)
        begin
        if clk_cdu'event and clk_cdu='1' then
                if ldar='1' then ar<=bus_reg;
            end if;
        end if;
        end process;
seq2:process(clk_cdu,pcclr,pcld,pcen,bus_reg)
        begin
        if pcclr='0' then pc<=(others=>'0');
        elsif clk_cdu'event and clk_cdu='1' then
                if (pcld='0' and pcen='1') then pc<=bus_reg;
            elsif (pcld='1' and pcen='1') then pc<=pc+1;
            end if;
        end if;
        end process;       
bus_reg<=inputd when sw_bus='0'  else
                 pc     when pc_bus='0'  else
                 (others=>'Z');
d<=bus_reg when (sw_bus='0' or pc_bus='0') else
   (others=>'Z');
arout<=ar;          
end rtl;


第二个器件代码如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity exp_r_alu is
port(        clk                          :in std_logic;
                sw_bus,r4_bus,r5_bus,alu_bus :in std_logic;
                lddr1,lddr2,ldr4,ldr5        :in std_logic;
                m,cn                         :in std_logic;
                s                            :in std_logic_vector(3 downto 0);
                k                            :in std_logic_vector(7 downto 0);
                d                            :inout std_logic_vector(7 downto 0) );
end exp_r_alu;
architecture rtl of exp_r_alu is
signal dr1,dr2,r4,r5,aluout,bus_reg:std_logic_vector(7 downto 0);
signal sel:std_logic_vector(5 downto 0);
begin
ldreg:process(clk,lddr1,lddr2,ldr4,ldr5,bus_reg)
        begin
        if clk'event and clk='1' then
                if lddr1='1' then dr1<=bus_reg;
            elsif lddr2='1' then dr2<=bus_reg;
            elsif ldr4='1' then r4<=bus_reg;
            elsif ldr5='1' then r5<=bus_reg;
            end if;
        end if;
        end process;
alu:process(m,cn,s,dr1,dr2,sel,aluout)
   begin
   sel<=m & cn & s;
   case sel is
        when "000000" => aluout<=dr1+1;
                ...(一堆功能..这里省略)
        when "101111" => aluout<=dr1;
        when others   => aluout<=x"ff";
end case;
end process;
bus_reg<=k      when sw_bus='0'  else
                 r4     when r4_bus='0'  else
                 r5     when r5_bus='0'  else
                 aluout  when alu_bus='0' else
                 (others=>'Z');
d<=bus_reg when (sw_bus='0' or r4_bus='0' or r5_bus='0' or alu_bus='0') else
   (others=>'Z');       
end rtl;

设计图如下





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?我要注册

x
 楼主| z2642x 发表于 2010-10-14 22:21:45 | 显示全部楼层
自己顶!!!!!!
hng1123 发表于 2011-4-5 09:03:24 | 显示全部楼层
我来试试啊
zhouming_lu 发表于 2015-1-11 19:48:18 | 显示全部楼层
我也帮楼主顶下
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-5-21 02:24 , Processed in 0.084430 second(s), 25 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表