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 57... |
Line 60... |
//
|
//
|
|
|
`include "top_defines.v"
|
`include "top_defines.v"
|
|
|
|
|
module oc8051_b_register (clk, rst, bit_in, data_in, wr, wr_bit,
|
module oc8051_b_register (clk, resetn, bit_in, data_in, wr, wr_bit,
|
wr_addr, data_out);
|
wr_addr, data_out);
|
|
|
|
|
input clk, rst, wr, wr_bit, bit_in;
|
input clk, resetn, wr, wr_bit, bit_in;
|
input [7:0] wr_addr, data_in;
|
input [7:0] wr_addr, data_in;
|
|
|
output [7:0] data_out;
|
output [7:0] data_out;
|
|
|
reg [7:0] data_out;
|
reg [7:0] data_out;
|
|
|
//
|
//
|
//writing to b
|
//writing to b
|
//must check if write high and correct address
|
//must check if write high and correct address
|
always @(posedge clk or posedge rst)
|
always @(posedge clk or negedge resetn)
|
begin
|
begin
|
if (rst)
|
if (resetn == 1'b0)
|
data_out <= #1 `OC8051_RST_B;
|
data_out <= #1 `OC8051_RST_B;
|
else if (wr) begin
|
else if (wr) begin
|
if (!wr_bit) begin
|
if (!wr_bit) begin
|
if (wr_addr==`OC8051_SFR_B)
|
if (wr_addr==`OC8051_SFR_B)
|
data_out <= #1 data_in;
|
data_out <= #1 data_in;
|