SAP computer之program counter
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的更多相关文章
- 指令计数器--Program counter
别名:指令指针.指令地址寄存器.程序计数器: 操作:顺序操作(计数器加一).分支操作(计数器修改): The program counter (PC), commonly called the ins ...
- SAP computer之input and MAR
Input and MAR Below the program counter is the input and MAR block. It includes the address and data ...
- 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 ...
- 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 ...
- 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 ...
- SAP computer之architecture
Simple-As-Possible computer introduces all the cruicial ideas behind computer operation without bury ...
- JVM之PC寄存器(Program Counter Register)
基本特性: 当前线程执行的字节码的行号指示器. Java虚拟机支持多个线程同时执行,每一个线程都有自己的pc寄存器. 任意时刻,一个线程都只会执行一个方法的代码,称为该线程的当前方法,对于非nativ ...
- 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 ...
- [Advance] How to debug a program (上)
Tool GDB Examining Memory (data or in machine instructions) You can use the command x (for “examine” ...
随机推荐
- MAC OS下JDK版本切换指南
刚上手的用MAC开发的小伙伴们会发现,MAC自带JDK版本为1.6,通常会安装在 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/目录下,但是更多 ...
- cogs 826. [Tyvj Feb11] GF打dota
826. [Tyvj Feb11] GF打dota ★★☆ 输入文件:dota.in 输出文件:dota.out 简单对比时间限制:1 s 内存限制:128 MB 众所周知,GF同学喜 ...
- ios 得用代理反向传值
应用场景:有时时候从界面A跳转到界面B,界面B在返回的时候须要将处理的结果传递给A. 实现思路:1,定义一个负责传值的协义,界面A拥有该协义属性,并实现该协义中的方法 2.界面B也拥有该协义属性(代理 ...
- 线段树 hdu3255 Farming
做了这么多扫描线的题,,基本都是一个思路. 改来改去,,无非就是维护的节点的内容以及push_up越写越复杂了而已 首先将价格排序处理一下编号,变成编号越大的powerfol越大 然后后面加入扫描线的 ...
- SQL SERVER的整型运算,让人大吃一惊
SQL SERVER的整型运算,让人大吃一惊好比下面代码:DECLARE @i INT = 50;DECLARE @dec DECIMAL(18,4);SET @dec = @i / 100;SELE ...
- silverlight学习笔记——新手对silverlight的认识(1)
这几天在搞silverlight.虽然silverlight没有前途,但始终是微软的一门技术,界面基本上与WPF共通,用一下也无妨. 学习过程并没有我原先想得那么容易,有些地方捣鼓了很久.究其原因,是 ...
- Delphi7中单元文件内各个部分的执行顺序
注:本文主要是讨论delphi程序启动时和退出时的执行顺序,期间有些知识来源于Delphi帮助,有些来自<Delphi7程序设计教程>(这本书只告诉我有initialization 和 f ...
- luogu1081 开车旅行 树上倍增
题目大意 小A和小B决定利用假期外出旅行,他们将想去的城市从1到N编号,且编号较小的城市在编号较大的城市的西边,已知各个城市的海拔高度互不相同,记城市i 的海拔高度为Hi,城市i 和城市j 之间的距离 ...
- oc26--Property,省略setget的声明
// // Person.h #import <Foundation/Foundation.h> @interface Person : NSObject { int _age; } /* ...
- php write excel
/** * 写excel方法 */ function writeExcel($tabArr, $dataArr,$path) { require_once CODE_BASE2 . '/util/ph ...