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” ...
随机推荐
- 【codeforces 765E】Tree Folding
[题目链接]:http://codeforces.com/problemset/problem/765/E [题意] 给你一棵树; 可以把一个节点的两条相同长度的链合并成一条链; 且这两条相同长度的链 ...
- Master Nginx(7) - Nginx for the Developer
Caching integration No application caching Caching in the database Caching in the filesystem Changin ...
- map put
public class test { static Map<String, Map<String, Integer>> mapB = new HashMap<Strin ...
- 给sunpinyin加速
因为sunpinyin词库一大就会卡,因此需要自己添加一个脚本给sunpinyin加速. 加速的原理就是把词库添加到内存,现在内存都这么大,根本不在乎这么几兆,当然输入体验更重要啦- 首先先建一个脚本 ...
- Istio是啥?一文带你彻底了解!
原标题:Istio是啥?一文带你彻底了解! " 如果你比较关注新兴技术的话,那么很可能在不同的地方听说过 Istio,并且知道它和 Service Mesh 有着牵扯. 这篇文章可以作为了解 ...
- App的登陆注册接口安全设计
最近一APP产品,我担任的主要模块之一是后台登录注册模块的接口开发.基本完成,就说说并记录一下关于登录注册接口的一些东西,因为也涉及到接口的安全方面的问题. 1.先一般的app的登录注册接口安全设计上 ...
- R语言为数据框添加列名或行名
1.添加列名 wts=c(1,1,1) names(wts)=c("setosa","versicolor","virginica") 2. ...
- 一个神奇的PHP框架:Phalcon 之初识
前言 公司的APP响应速度比较慢,公司大神决定使用C语言编写的PHP框架Phalcon 代替原来的框架,响应速度有比较大的提升.以前只是听说过,没有深入的了解过.即然工作中有用到,便花点时间了解了下, ...
- iOS: 在Swift中优雅的实现Substring
在Swift中,当我们想要截取某个字符串时,方法如下: let carNumber = "沪A12345" let startIndex = advance(userCar.car ...
- CF #329 C
C题我还以为是拉格朗日插值... 其实可以想象到,必须有这样一个函数,经过某一点时,其它圆相关的函数要为0. 于是,可以构造这样的一个函数,对于x有 (x/2)*(1-abs(t-i)+abs(1-a ...