OpenCores
URL https://opencores.org/ocsvn/oms8051mini/oms8051mini/trunk

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_tc2.v] - Diff between revs 2 and 25

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 25
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 56... Line 59...
 
 
`include "top_defines.v"
`include "top_defines.v"
 
 
 
 
 
 
module oc8051_tc2 (clk, rst,
module oc8051_tc2 (clk, resetn,
            wr_addr,
            wr_addr,
            data_in, bit_in,
            data_in, bit_in,
            wr, wr_bit,
            wr, wr_bit,
            t2, t2ex,
            t2, t2ex,
            rclk, tclk,
            rclk, tclk,
Line 70... Line 73...
            t2con, tl2, th2, rcap2l, rcap2h);
            t2con, tl2, th2, rcap2l, rcap2h);
 
 
input [7:0]  wr_addr,
input [7:0]  wr_addr,
             data_in;
             data_in;
input        clk,
input        clk,
             rst,
             resetn,
             wr,
             wr,
             wr_bit,
             wr_bit,
             t2,
             t2,
             t2ex,
             t2ex,
             bit_in,
             bit_in,
Line 109... Line 112...
assign exen2 = t2con[3];
assign exen2 = t2con[3];
assign tr2   = t2con[2];
assign tr2   = t2con[2];
assign ct2   = t2con[1];
assign ct2   = t2con[1];
assign cprl2 = t2con[0];
assign cprl2 = t2con[0];
 
 
always @(posedge clk or posedge rst)
always @(posedge clk or negedge resetn)
begin
begin
  if (rst) begin
  if (resetn == 1'b0) begin
    t2con <= #1 `OC8051_RST_T2CON;
    t2con <= #1 `OC8051_RST_T2CON;
  end else if ((wr) & !(wr_bit) & (wr_addr==`OC8051_SFR_T2CON)) begin
  end else if ((wr) & !(wr_bit) & (wr_addr==`OC8051_SFR_T2CON)) begin
    t2con <= #1 data_in;
    t2con <= #1 data_in;
  end else if ((wr) & (wr_bit) & (wr_addr[7:3]==`OC8051_SFR_B_T2CON)) begin
  end else if ((wr) & (wr_bit) & (wr_addr[7:3]==`OC8051_SFR_B_T2CON)) begin
    t2con[wr_addr[2:0]] <= #1 bit_in;
    t2con[wr_addr[2:0]] <= #1 bit_in;
Line 129... Line 132...
 
 
//
//
//th2, tl2
//th2, tl2
assign run = tr2 & ((!ct2 & pres_ow) | (ct2 & tc2_event));
assign run = tr2 & ((!ct2 & pres_ow) | (ct2 & tc2_event));
 
 
always @(posedge clk or posedge rst)
always @(posedge clk or negedge resetn)
begin
begin
  if (rst) begin
  if (resetn == 1'b0) begin
//
//
// reset
// reset
//
//
    tl2 <= #1 `OC8051_RST_TL2;
    tl2 <= #1 `OC8051_RST_TL2;
    th2 <= #1 `OC8051_RST_TH2;
    th2 <= #1 `OC8051_RST_TH2;
Line 192... Line 195...
end
end
 
 
 
 
//
//
// rcap2l, rcap2h
// rcap2l, rcap2h
always @(posedge clk or posedge rst)
always @(posedge clk or negedge resetn)
begin
begin
  if (rst) begin
  if (resetn == 1'b0) begin
    rcap2l <= #1 `OC8051_RST_RCAP2L;
    rcap2l <= #1 `OC8051_RST_RCAP2L;
    rcap2h <= #1 `OC8051_RST_RCAP2H;
    rcap2h <= #1 `OC8051_RST_RCAP2H;
  end else if ((wr) & !(wr_bit) & (wr_addr==`OC8051_SFR_RCAP2H)) begin
  end else if ((wr) & !(wr_bit) & (wr_addr==`OC8051_SFR_RCAP2H)) begin
    rcap2h <= #1 data_in;
    rcap2h <= #1 data_in;
  end else if ((wr) & !(wr_bit) & (wr_addr==`OC8051_SFR_RCAP2L)) begin
  end else if ((wr) & !(wr_bit) & (wr_addr==`OC8051_SFR_RCAP2L)) begin
Line 210... Line 213...
end
end
 
 
 
 
//
//
//
//
always @(posedge clk or posedge rst)
always @(posedge clk or negedge resetn)
begin
begin
  if (rst) begin
  if (resetn == 1'b0) begin
    neg_trans <= #1 1'b0;
    neg_trans <= #1 1'b0;
    t2ex_r <= #1 1'b0;
    t2ex_r <= #1 1'b0;
  end else if (t2ex) begin
  end else if (t2ex) begin
    neg_trans <= #1 1'b0;
    neg_trans <= #1 1'b0;
    t2ex_r <= #1 1'b1;
    t2ex_r <= #1 1'b1;
Line 229... Line 232...
  end
  end
end
end
 
 
//
//
//
//
always @(posedge clk or posedge rst)
always @(posedge clk or negedge resetn)
begin
begin
  if (rst) begin
  if (resetn == 1'b0) begin
    tc2_event <= #1 1'b0;
    tc2_event <= #1 1'b0;
    t2_r <= #1 1'b0;
    t2_r <= #1 1'b0;
  end else if (t2) begin
  end else if (t2) begin
    tc2_event <= #1 1'b0;
    tc2_event <= #1 1'b0;
    t2_r <= #1 1'b1;
    t2_r <= #1 1'b1;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.