Program counter

  The program is stored in memory with the first instruction at binary address 0000, the second instruction at address 0001, the third at address 0010 and so on.  The program counter, which is part of the control unit, counts from 0000 to 1111. Its job is to send to the memory the address of next instruction.

  The program counter is reset to 0000 before computer run. When the computer run begins, the program counter sends address 0000 to the memory. The program counter is then incremented to get 0001. After the first instruction is fetched and executed, the program counter sends address 0001 to the memory. Again the program counter is incremented. After the second isntruction is fetched and executed, the program counter sends address 0010 to the memory. In this way, the program counter is keeping track of the next instruction to be fetched and executed.

  The program counter is like someone pointing at a list of instruction, saying do this first, do this second, etc. This is why the program counter is sometimes called a pointer; it points to an address in memory where something important is being stored.

 library IEEE;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all; entity PC is
port
(
EP : in std_logic;     --! Active high output enable from PC, or tri-state
CLR : in std_logic;     --! Active high asynchronous clear
CLK : in std_logic;      --! Falling edge clock
CP : in std_logic;     --! Active high enable PC to count
Q : out std_logic_vector( downto ) --! 4-bit PC output
);
end PC ; architecture beh of PC is signal count : std_logic_vector( downto ); begin process (CLR,EP,CP,CLK,count)
begin
if CLR = '' then
Q <= "";
count <= "";
elsif CP = '' then
if (CLK'event and CLK = '') then
if count < "" then
count <= count + ;
else
count <= "";
end if;
end if;
end if; if EP = '' then
Q <= "ZZZZ";
else
Q <= count;
end if; end process; end beh;

Question: why do not use the following code in process?

 begin
if EP = '' then
Q <= "ZZZZ";
elsif CLR = '' then
Q <= "";
count <= "";
elsif CP = '' then
if(CLK'event and CLK = '') then
if count < "" then
count <= count + ;
else
count <= "";
end if;
end if;
end if; end process;

Answer: first code, line 40, Q <= count


Own code for ASIC: use package ieee.numeric_std

 library IEEE;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity PC is
port
(
EP : in std_logic; --! Active high output enable from PC, or tri-state
CLR : in std_logic; --! Active high asynchronous clear
CLK : in std_logic; --! Falling edge clock
CP : in std_logic; --! Active high enable PC to count
Q : out std_logic_vector( downto ) --! 4-bit PC output
);
end PC ; architecture beh of PC is signal count : std_logic_vector( downto ); begin process (CLR,EP,CP,CLK,count)
begin
if CLR = '' then
25  -- Q <= "0000";
count <= "";
elsif CP = '' then
if (CLK'event and CLK = '') then
if count < "" then
count <= std_logic_vector(unsigned(count) + );
else
count <= "";
end if;
end if;
end if; if EP = '' then
Q <= "ZZZZ"; -- not good, in ASIC use only std_logic signal state '0', '1'
else
Q <= count;
end if; end process; end beh;

 Question: In ASIC design, why use only std_logic signal states '0', '1'(and 'Z' for FPGA)???

SAP computer之program counter的更多相关文章

  1. 指令计数器--Program counter

    别名:指令指针.指令地址寄存器.程序计数器: 操作:顺序操作(计数器加一).分支操作(计数器修改): The program counter (PC), commonly called the ins ...

  2. SAP computer之input and MAR

    Input and MAR Below the program counter is the input and MAR block. It includes the address and data ...

  3. Will Georgia Tech's $7K online M.S. in computer science program make the grade?

    https://newatlas.com/georgia-tech--graduate-computer-science-degree-mooc/28763/ Georgia Tech to offe ...

  4. SAP computer之RAM

    RAM The RAM is a 16 X 8 static TTL RAM. We can program the RAM by means of the address and data swit ...

  5. SAP Module Pool Program Learning Documentation——Commit Work and Update dtab

    When using Native SQL to directly manipulate database tables, it makes a difference to use COMMIT WO ...

  6. SAP computer之architecture

    Simple-As-Possible computer introduces all the cruicial ideas behind computer operation without bury ...

  7. JVM之PC寄存器(Program Counter Register)

    基本特性: 当前线程执行的字节码的行号指示器. Java虚拟机支持多个线程同时执行,每一个线程都有自己的pc寄存器. 任意时刻,一个线程都只会执行一个方法的代码,称为该线程的当前方法,对于非nativ ...

  8. Application binary interface and method of interfacing binary application program to digital computer

    An application binary interface includes linkage structures for interfacing a binary application pro ...

  9. [Advance] How to debug a program (上)

    Tool GDB Examining Memory (data or in machine instructions) You can use the command x (for “examine” ...

随机推荐

  1. 发现:Click事件也能获取鼠标单击的坐标

    按照MSDN的说明以及平时的习惯,我们要获取鼠标单击时的相对坐标,都会使用MouseClick等事件,今天,偶然发现,原来Click事件也可以. /* 惊天地泣鬼神的考古业绩. * 原来Cilck事件 ...

  2. JSTL 实现 为Select赋多个值

    需要注意需要在.jsp文件中引入相应的类库 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core ...

  3. jenkins 构建被中断 脚本却还在执行

    JobA + git clean -df 构建被中断 被 XXX 终止 Finished: ABORTED 再次jenkins调用JobA 后台进程中 出现了两个JobA的脚本同时执行,导致一些莫名其 ...

  4. 如何删除电脑中使用过的COM端口

    打开注册表编辑器:开始--运行中输入regedit就可以了 打开注册表 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arb ...

  5. mongodb之监控

    监控方式 命令行工具 mongostat命令 用途 用于mongod或者mongos操作类型统计,网络流量统计,当前并发数等统计 用法 mongostat options <sleeptime& ...

  6. JAVA模拟登录实例

    近期在做公司一个web项目.要求在我们的系统上,可以显示其它站点上的数据. 刚開始接到这个任务时,还在想.简单的非常.直接用UrlConection直接进入该网页,然后获取该网页的html,取到想要的 ...

  7. android获取当前软件版本号号和版本号名称

    <span style="font-size:18px;">/** * 获取本地软件版本号 */ public static int getLocalVersion(C ...

  8. 初识ASP.NET---点滴的积累---ASP.NET学习小结

    差点儿相同十多天前学习完了北大青鸟的学习视频,没想到没几天的时间就看完了XML视频和牛腩的Javascript视频.学习完了也该总结总结.理理自己的思路.消化一下自己学习到的东西. 视频中的理论知识并 ...

  9. Ubuntu14.04下Android系统与应用开发软件完整apt-get 源。

    # deb cdrom:[Ubuntu 14.04.1 LTS _Trusty Tahr_ - Release amd64 (20140722.2)]/ trusty main restricted# ...

  10. 基于Windows Azure 搭建基于SharePoint 2010 Intranet、Extranet、Internet (4): 配置传出邮件服务: 使用 outlook.com 发送邮件通知

    前几篇文章,已经安装了SharePoint 2010,今天将演示如何配置传出邮件.由于某些原因,企业可能没有安装自己邮件服务器,此时我们可以使用公共的邮箱服务来发送邮件通知,比如outlook.com ...