Line 16... |
Line 16... |
//// - Dinesh Annayya, dinesha@opencores.org ////
|
//// - Dinesh Annayya, dinesha@opencores.org ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// v0.0 - Dinesh A, 5th Jan 2017
|
//// v0.0 - Dinesh A, 5th Jan 2017
|
//// 1. Active edge of reset changed from High to Low
|
//// 1. Active edge of reset changed from High to Low
|
|
//// v0.1 - Dinesh A, 6th Jan 2017
|
|
//// 1. pc_next logic added
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
//// ////
|
//// ////
|
//// This source file may be used and distributed without ////
|
//// This source file may be used and distributed without ////
|
Line 98... |
Line 100... |
rd_sel,
|
rd_sel,
|
wr_sel,
|
wr_sel,
|
pc_wr_sel,
|
pc_wr_sel,
|
pc_wr,
|
pc_wr,
|
pc,
|
pc,
|
|
pc_next,
|
rd,
|
rd,
|
mem_wait,
|
mem_wait,
|
mem_act,
|
mem_act,
|
istb,
|
istb,
|
|
|
Line 301... |
Line 304... |
|
|
input [2:0] pc_wr_sel;
|
input [2:0] pc_wr_sel;
|
|
|
input pc_wr;
|
input pc_wr;
|
output [15:0] pc;
|
output [15:0] pc;
|
|
output [15:0] pc_next;
|
|
|
reg [15:0] pc;
|
reg [15:0] pc,pc_next;
|
|
|
//
|
//
|
//pc program counter register, save current value
|
//pc program counter register, save current value
|
reg [15:0] pc_buf;
|
reg [15:0] pc_buf;
|
wire [15:0] alu;
|
wire [15:0] alu;
|
Line 831... |
Line 835... |
begin
|
begin
|
if (resetn == 1'b0)
|
if (resetn == 1'b0)
|
pc <= #1 16'h0;
|
pc <= #1 16'h0;
|
else if (pc_wr_r2)
|
else if (pc_wr_r2)
|
pc <= #1 pc_buf;
|
pc <= #1 pc_buf;
|
else if (rd & !int_ack_t)
|
else if (rd && !int_ack_t && !(pc_wr && (pc_wr_sel != `OC8051_PIS_AH)) && !pc_wr_r)
|
pc <= #1 pc_buf - 16'h8 + {13'h0, op_pos} + {14'h0, op_length};
|
pc <= #1 pc_buf - 16'h8 + {13'h0, op_pos} + {14'h0, op_length};
|
end
|
end
|
|
|
|
always @(posedge clk or negedge resetn)
|
|
begin
|
|
if (resetn == 1'b0)
|
|
pc_next <= #1 16'h0;
|
|
else if (pc_wr_r2)
|
|
pc_next <= #1 pc_buf;
|
|
else if (rd && !int_ack_t)
|
|
pc_next <= #1 pc_buf - 16'h8 + {13'h0, op_pos} + {14'h0, op_length};
|
|
end
|
|
|
always @(posedge clk or negedge resetn)
|
always @(posedge clk or negedge resetn)
|
begin
|
begin
|
if (resetn == 1'b0) begin
|
if (resetn == 1'b0) begin
|
pc_buf <= #1 `OC8051_RST_PC;
|
pc_buf <= #1 `OC8051_RST_PC;
|