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” ...
随机推荐
- Silverlight之我见——DataGrid数据验证
<UserControl x:Class="DataValidationSample.MainPage" xmlns="http://schemas.microso ...
- Dubbo学习总结(2)——Dubbo架构详解
一.前言 部门去年年中开始各种改造,第一步是模块服务化,这边初选dubbo试用在一些非重要模块上,慢慢引入到一些稍微重要的功能上,半年时间,学习过程及线上使用遇到的些问题在此总结下. 整理这篇文章差不 ...
- 联赛前集训日记Day1
考试 炸的凄惨 T1 显然要高精搞一下,然而我的$DFS$竟然比我的$O(n^{2})$递推快 T2 欧拉路径的题,很不可做的样子,就没敢费时间打 T3 $DFS$枚举可过,然而我太蠢 GG 刷题 改 ...
- 小胖说事14--------IOS字体大小,字号的问题 PX转化为UIFont
PX和Font之间相互转换公示表: 计算公式为:font=(像素PX)/(96/72).
- jsp上传下载+SmartUpload插件上传
使用之前须要自己下载jspSmartUpload.jar包 这里找到一个支持中文的jar包,下载地址例如以下: http://www.blogjava.net/Files/hijackwust/jsm ...
- ListView点击或选中item改变背景
点击或选中ListView中的一项后.使item背景改变,失去焦点相同显示选中的背景.又一次选中另外一项才刷新: 在Adapter中配置: public class MyAdapter extends ...
- Kids Store - OpenCart 自适应主题模板 ABC-0022
KIDS STORE - OPENCART 自适应主题模板 ABC-0022 FEATURES Get FREE Lifetime Updates Get FREE On-Going Support ...
- JavaScript探秘:强大的原型和原型链
// foo 变量是上例中的 for(var i in foo) { if (foo.hasOwnProperty(i)) { console.log(i); } } JavaScript 不包括传统 ...
- 启动VIP报CRS-1028/CRS-0223致使VIP状态为UNKNOWN故障分析与解决
CRS版本号为10.2.0.4 1.VIP State为UNKNOWN [root@XXdb1 ~]# crs_stat -t Name Type Target ...
- 蒟蒻的数位DP专题总结
BZOJ 1026: [SCOI2009]windy数: 题目链接: http://www.lydsy.com/JudgeOnline/problem.php?id=1026 d ...