Verilog MIPS32 CPU(五)-- CP0
- Verilog MIPS32 CPU(一)-- PC寄存器
- Verilog MIPS32 CPU(二)-- Regfiles
- Verilog MIPS32 CPU(三)-- ALU
- Verilog MIPS32 CPU(四)-- RAM
- Verilog MIPS32 CPU(五)-- CP0
- Verilog MIPS32 CPU(六)-- MDU
- Verilog MIPS32 CPU(七)-- DIV、DIVU
- Verilog MIPS32 CPU(八)-- 控制器
module CP0(
input clk,
input rst,
input teq_exc,
input mtc0, //CPU instruction is Mtc0
input [:] pc,
input [:] addr, //Specifies CP0 register
input [:] wdata, //Data from GP register to replace CP0 register
input eret, //instruction is ERET(Exception Return)
input [:] cause,
output [:] rdata, //Data from CP0 register for GP register,
output [:] exc_addr //Address for PC at the beginning of an exception
); parameter SYSCALL = 'b1000,
BREAK = 'b1001,
TEQ = 'b1101,
IE = ;
// status = 12,
// cause = 13,
// epc = 14, reg [:] cop0 [:];
wire [:] status = cop0[];
integer i; wire exception = status[]&& ((status[]&&cause==SYSCALL)||
(status[]&&cause==BREAK) ||
(status[]&&cause==TEQ&&teq_exc)); always@(posedge clk or posedge rst) begin
if(rst)begin
for(i=;i<;i=i+)
cop0[i]<=;
end
else begin
if(mtc0)
cop0[addr] <= wdata;
else if(exception)begin
cop0[] <= pc;
cop0[] <= status<<;
cop0[] <= {'b0,cause,2'b0};
end
else if(eret) begin
cop0[] <= status>>;
end
end
end
assign exc_addr = eret?cop0[]:'h4;
assign rdata = cop0[addr]; endmodule
Verilog MIPS32 CPU(五)-- CP0的更多相关文章
- Verilog MIPS32 CPU(八)-- 控制器
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- Verilog MIPS32 CPU(六)-- MDU
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- Verilog MIPS32 CPU(七)-- DIV、DIVU
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- Verilog MIPS32 CPU(四)-- RAM
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- Verilog MIPS32 CPU(三)-- ALU
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- Verilog MIPS32 CPU(二)-- Regfiles
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- Verilog MIPS32 CPU(一)-- PC寄存器
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- Verilog MIPS32 CPU(九)-- 顶层文件
`timescale 1ns / 1ps /////////////////////////////////////////////////////////////////////////////// ...
- FPGA Prototyping By Verilog Examples第五章 状态机FSM设计
上升沿检测电路之Moore型FSM // Listing 5.3module edge_detect_moore ( input wire clk, reset, input wire level, ...
随机推荐
- css伪类(Pseudo-classes)
简介:伪类(Pseudo classes)是选择符的螺栓,用来指定一个或者与其相关的选择符的状态.它们的形式是selector:pseudo class { property: value; },简单 ...
- JavaScript知识总结--引用类型(Object-Array-Function-Global-Math)
对象(引用类型的值)是引用类型的一个实例,新对象是使用new操作符后跟一个构造函数来创建的.构造函数本身就是一个函数,该函数用于创建新对象.ECMAScript提供了很多原生引用类型(Object,A ...
- org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
使用Hibernate 插入List数据时出现了以下异常: SLF4J: The requested version 1.6 by your slf4j binding is not compatib ...
- MyBatis3 用log4j在控制台输出 SQL
用log4j在控制台输出 SQL 在spring-mybatis.xml中配置 <bean id="sqlSessionFactory" class="org.my ...
- iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController
iOS学习之UINavigationController详解与使用(一)添加UIBarButtonItem是上篇,我们接着讲UINavigationController的重要作用,页面的管理和切换. ...
- 简述amixer及其用法
最近接触到amixer,大概明白了其意思和具体用法,简述如下. alsamixer是Linux 音频架构ALSA中的Alsa工具的其中一个,用于配置音频的各个参数. alsamixer是基于文本下的图 ...
- GL_LINES & GL_LINE_STRIP & GL_LINE_LOOP
[GL_LINES] 独立的线段,下式中,p2与p3间没有连线. [GL_LINE_STRIP] 连续的线段,下式中, p2与p3会连成线段. [GL_LINE_LOOP] 参考:<计算机图形学 ...
- [erlang 001] erlang中的错误及异常处理
一. erlang中的错误 1. 分类 1) 编译错误:主要是编译器检测出的代码语法错误: 2) 逻辑错误:是指程序没有完成预期的工作,属于开发人员的问题: 3) 运行时错误:是指erlang运行时抛 ...
- Qt Signal and Slot
Qt4中的信号槽 Qt4中的信号槽是通过SIGNAL,SLOT两个宏,将参数转换成字符串.Qt编译前,会从源码的头文件中提取由signal和slot声明的信号和槽的函数, 将其组成一张信号和槽对应的字 ...
- C#异步中的Task,async,await
class Program { static void Main(string[] args) { Console.WriteLine("我是主线程,线程ID:{0}", Thre ...