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” ...
随机推荐
- tipsText表单验证(注册)
注册表单验证脚本 <script src="/assets/skins/js/jquery-1.11.2.min.js"></script> <scr ...
- ansible ad-hoc 参考
# 检查主机连接 # ansible test -m ping # 执行远程命令 # ansible test -m command -a 'uptime' # 执行主控端脚本 # ansible t ...
- 几个有用的shell命令
1.!$ 是一个特殊的环境变量,它代表了上一个命令的最后一个字符串.如:你可能会这样: $mkdir mydir$mv mydir yourdir$cd yourdir 可以改成: $mkdir my ...
- 洛谷 P2827 BZOJ 4721 UOJ #264 蚯蚓
题目描述 本题中,我们将用符号表示对c向下取整,例如:. 蛐蛐国最近蚯蚓成灾了!隔壁跳蚤国的跳蚤也拿蚯蚓们没办法,蛐蛐国王只好去请神刀手来帮他们消灭蚯蚓. 蛐蛐国里现在共有n只蚯蚓(n为正整数).每只 ...
- hdu 3657 最大点权独立集变形(方格取数的变形最小割,对于最小割建图很好的题)
转载:http://blog.csdn.net/cold__v__moon/article/details/7924269 /* 这道题和方格取数2相似,是在方格取数2的基础上的变形. 方格取数2解法 ...
- 修改tomcat端口号的方法
8080是Tomcat服务器的默认的端口号.我们可以通过修改Tomcat服务器的conf目录下的主配置文件server.xml来更改.用记事本打开server.xml文件,找到如下部分: 以下为引用的 ...
- 对SPI、IIC、IIS、UART、CAN、SDIO、GPIO的解释
SPI SPI(Serial Peripheral Interface:串行外设接口); SPI总线由三条信号线组成:串行时钟(SCLK).串行数据输出(SDO).串行数据输入(SDI).SPI总线可 ...
- nyoj_49_开心的小明_201403161133
开心的小明 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 小明今天很开心,家里购置的新房就要领钥匙了,新房里有一间他自己专用的很宽敞的房间.更让他高兴的是,妈妈昨天 ...
- POJ 3061 Subsequence 尺取
Subsequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14698 Accepted: 6205 Desc ...
- 关于Android开发数据存储的方式(一)
关于Android开发数据存储方式(一) 在厦门做Android开发也有两个月了,快情人节了.我还在弄代码. 在微信平台上开发自己的APP,用到了数据存储的知识,如今总结一下: 整体的来讲.数据存储方 ...