Line 42... |
Line 42... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.7 2002/09/30 17:33:59 simont
|
|
// prepared header
|
|
//
|
//
|
//
|
|
|
|
|
// synopsys translate_off
|
// synopsys translate_off
|
`include "oc8051_timescale.v"
|
`include "oc8051_timescale.v"
|
// synopsys translate_on
|
// synopsys translate_on
|
|
|
`include "oc8051_defines.v"
|
`include "oc8051_defines.v"
|
|
|
|
|
module oc8051_psw (clk, rst, wr_addr, rd_addr, data_in, wr, wr_bit, data_out, data_out_r, bit_out, p, cy_in, ac_in, ov_in, set);
|
module oc8051_psw (clk, rst, wr_addr, rd_addr, data_in, wr, wr_bit, data_out, bit_out, p, cy_in, ac_in, ov_in, set, bank_sel);
|
//
|
//
|
// clk (in) clock
|
// clk (in) clock
|
// rst (in) reset
|
// rst (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]
|
// data_out (out) data output [oc8051_ram_sel.psw]
|
// data_out (out) data output [oc8051_ram_sel.psw]
|
// data_out_r (out) data output [oc8051_ram_sel.psw]
|
|
// p (in) parity [oc8051_acc.p]
|
// p (in) parity [oc8051_acc.p]
|
// cy_in (in) input bit data [oc8051_alu.desCy]
|
// cy_in (in) input bit data [oc8051_alu.desCy]
|
// ac_in (in) auxiliary carry input [oc8051_alu.desAc]
|
// ac_in (in) auxiliary carry input [oc8051_alu.desAc]
|
// 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]
|
Line 76... |
Line 78... |
input [1:0] set;
|
input [1:0] set;
|
input [2:0] rd_addr;
|
input [2:0] rd_addr;
|
input [7:0] wr_addr, data_in;
|
input [7:0] wr_addr, data_in;
|
|
|
output bit_out;
|
output bit_out;
|
|
output [1:0] bank_sel;
|
output [7:0] data_out;
|
output [7:0] data_out;
|
output [7:0] data_out_r;
|
|
|
|
reg bit_out;
|
reg bit_out;
|
reg [7:0] data;
|
reg [7:0] data;
|
wire wr_psw;
|
wire wr_psw;
|
|
|
assign wr_psw = (wr & (wr_addr==`OC8051_SFR_PSW) && !wr_bit);
|
assign wr_psw = (wr & (wr_addr==`OC8051_SFR_PSW) && !wr_bit);
|
|
|
assign data_out = wr_psw ? {data_in[7:1],p}:{data[7:1], p};
|
assign bank_sel = wr_psw ? data_in[4:3]:data[4:3];
|
assign data_out_r = data;
|
assign data_out = data;
|
|
|
//
|
//
|
//case writing to psw
|
//case writing to psw
|
always @(posedge clk or posedge rst)
|
always @(posedge clk or posedge rst)
|
begin
|
begin
|