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. ansible - 基本用法

    目录 ansible - 01 一. 安装与使用 ansible命令格式 查看ansible生成的配置文件 ssh认证方式 ansible的第一个命令 弱口令校验 host-pattern的格式 模块 ...

  2. Windows读取NXP MiFare Ultralight C类型NFC卡片的信息

    1,读取 我们需要外接一个NFC Reader让Windows可以读取NFC卡片的内容. 因为特殊原因,我们选择了Sony rc-s380 NFC Reader.相关介绍 我们需要下载并安装NFC P ...

  3. 相同的雪花 Hash

    相同的雪花 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 You may have heard that no two snowflakes are alike. ...

  4. F - True Liars 带权并查集

    After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ...

  5. [bzoj1007][HNOI2008]水平可见直线_单调栈

    水平可见直线 bzoj-1007 HNOI-2008 题目大意:给你n条直线,为你从上往下看能看见多少跳直线. 注释:能看见一条直线,当且仅当这条直线上存在一条长度>0的线段使得这条线段上方没有 ...

  6. 学习C#和SQL的书籍

    1. <21天学通C#> 周红安等编著  电子工业出版社 2.  http://blog.csdn.net/21aspnet/article/details/1682200 3. < ...

  7. [ javascript ] getElementsByClassName与className和getAttribute!

    对于javascript中的getElementsByClassName 在IE 6/7/8 不支持问题. 那么须要模拟出getElementsByClassName  须要採用className属性 ...

  8. Spring cloud config配置文件加密解密

    Spring cloud config配置文件加密解密 学习了:http://blog.csdn.net/u010475041/article/details/78110349 学习了:<Spr ...

  9. Android 绘制圆形图片

    经常在项目中,会遇到使用圆形头像. 然而图片往往不是圆形的,我们须要对图片进行处理.以达到圆形图片的效果.这里.我总结了一下经常使用的android圆形图片的绘制的方法. 主要有以下几种方式:1.画布 ...

  10. Apache日志优化

    apache执行时会记录其处理的全部请求的相关信息.同一时候,也会记录在处理过程中发生异常状况的相关信息. server能够用多种格式将与请求相关的活动信息记录在多个日志文件里,只是却仅仅能记录一份错 ...