SOC课程实验——PC程序计数器设计

SOC课程实验

PC程序计数器设计

一、功能分析

1、全局异步复位功能

ADDR<=“000000000000”;
数据总线高阻态;

2、加1功能

clk_PC上升沿有效;
M_PC高电平有效,PC+1->ADDR;

3、地址更新功能

clk_PC上升沿有效,nLD_PC低电平有效,新的PC->ADDR

4、PC数值送到数据总线

nPCH和nPCL低电平有效,注意分两次输出到总线上,先高8位后低8位。

二、程序实现

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity module_PC is port(
    clk_PC,nreset,nLD_PC,M_PC,nPCH,nPCL:in std_logic;
    PC:in std_logic_vector(11 downto 0);
    ADDR:out std_logic_vector(11 downto 0);
    data:out std_logic_vector(7 downto 0));
end entity module_PC;

architecture behavior of module_PC is
    signal pc_buffer: std_logic_vector(11 downto 0);

begin
    process(clk_PC,nreset)
    begin
        if(nreset='1')then
            pc_buffer<=PC;
            ADDR<=(others=>'0');
            data<=(others=>'Z');
        else
            if(clk_PC'event and clk_pc='1')then
                if(M_PC='1')then
                    pc_buffer <= pc_buffer +1;
                    ADDR<=pc_buffer;
                elsif(nLD_PC='0')then
              
                    ADDR<=pc_buffer;
                elsif(nPCH='0')then
                    data<="0000" & pc_buffer(11 downto 8);
                elsif(nPCL='0')then
                    data<=pc_buffer(7 downto 0);
                end if;
            end if;
        end if;
    end process;
end architecture behavior;
  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值