Line 14... |
Line 14... |
//// Author(s): ////
|
//// Author(s): ////
|
//// - Simon Teran, simont@opencores.org ////
|
//// - Simon Teran, simont@opencores.org ////
|
//// - Dinesh Annayya , dinesha@opencores.org ////
|
//// - Dinesh Annayya , dinesha@opencores.org ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
//// v0.0 - Dinesh A, 5th Jan 2017
|
|
//// 1. Active edge of reset changed from High to Low
|
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// 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 ////
|
//// restriction provided that this copyright statement is not ////
|
//// restriction provided that this copyright statement is not ////
|
Line 64... |
Line 67... |
|
|
|
|
`include "top_defines.v"
|
`include "top_defines.v"
|
|
|
|
|
module oc8051_psw (clk, rst, wr_addr, data_in, wr, wr_bit, data_out, p,
|
module oc8051_psw (clk, resetn, wr_addr, data_in, wr, wr_bit, data_out, p,
|
cy_in, ac_in, ov_in, set, bank_sel);
|
cy_in, ac_in, ov_in, set, bank_sel);
|
//
|
//
|
// clk (in) clock
|
// clk (in) clock
|
// rst (in) reset
|
// resetn (in) reset
|
// addr (in) write address [oc8051_ram_wr_sel.out]
|
// addr (in) write address [oc8051_ram_wr_sel.out]
|
// data_in (in) data input [oc8051_alu.des1]
|
// data_in (in) data input [oc8051_alu.des1]
|
// wr (in) write [oc8051_decoder.wr -r]
|
// wr (in) write [oc8051_decoder.wr -r]
|
// wr_bit (in) write bit addresable [oc8051_decoder.bit_addr -r]
|
// wr_bit (in) write bit addresable [oc8051_decoder.bit_addr -r]
|
// p (in) parity [oc8051_acc.p]
|
// p (in) parity [oc8051_acc.p]
|
Line 81... |
Line 84... |
// ov_in (in) overflov input [oc8051_alu.desOv]
|
// ov_in (in) overflov input [oc8051_alu.desOv]
|
// set (in) set psw (write to caryy, carry and overflov or carry, owerflov and ac) [oc8051_decoder.psw_set -r]
|
// set (in) set psw (write to caryy, carry and overflov or carry, owerflov and ac) [oc8051_decoder.psw_set -r]
|
//
|
//
|
|
|
|
|
input clk, rst, wr, p, cy_in, ac_in, ov_in, wr_bit;
|
input clk, resetn, wr, p, cy_in, ac_in, ov_in, wr_bit;
|
input [1:0] set;
|
input [1:0] set;
|
input [7:0] wr_addr, data_in;
|
input [7:0] wr_addr, data_in;
|
|
|
output [1:0] bank_sel;
|
output [1:0] bank_sel;
|
output [7:0] data_out;
|
output [7:0] data_out;
|
Line 98... |
Line 101... |
assign bank_sel = wr_psw ? data_in[4:3]:data[4:3];
|
assign bank_sel = wr_psw ? data_in[4:3]:data[4:3];
|
assign data_out = {data[7:1], p};
|
assign data_out = {data[7:1], p};
|
|
|
//
|
//
|
//case writing to psw
|
//case writing to psw
|
always @(posedge clk or posedge rst)
|
always @(posedge clk or negedge resetn)
|
begin
|
begin
|
if (rst)
|
if (resetn == 1'b0)
|
data <= #1 `OC8051_RST_PSW;
|
data <= #1 `OC8051_RST_PSW;
|
|
|
//
|
//
|
// write to psw (byte addressable)
|
// write to psw (byte addressable)
|
else begin
|
else begin
|