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

Subversion Repositories 8051

[/] [8051/] [trunk/] [rtl/] [verilog/] [oc8051_int.v] - Diff between revs 90 and 116

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

Rev 90 Rev 116
Line 44... Line 44...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.7  2003/03/28 17:45:57  simont
 
// change module name.
 
//
// Revision 1.6  2003/01/13 14:14:41  simont
// Revision 1.6  2003/01/13 14:14:41  simont
// replace some modules
// replace some modules
//
//
// Revision 1.5  2002/09/30 17:33:59  simont
// Revision 1.5  2002/09/30 17:33:59  simont
// prepared header
// prepared header
Line 61... Line 64...
`include "oc8051_timescale.v"
`include "oc8051_timescale.v"
//synopsys translate_on
//synopsys translate_on
 
 
 
 
 
 
module oc8051_int (clk, rst, wr_addr, rd_addr, data_in, bit_in, data_out, bit_out, wr, wr_bit,
module oc8051_int (clk, rst,
 
        wr_addr,
 
        data_in, bit_in,
 
        wr, wr_bit,
//timer interrupts
//timer interrupts
        tf0, tf1, t2_int,
        tf0, tf1, t2_int,
        tr0, tr1,
        tr0, tr1,
//external interrupts
//external interrupts
        ie0, ie1,
        ie0, ie1,
//uart interrupts
//uart interrupts
        uart_int,
        uart_int,
//to cpu
//to cpu
        intr, reti, int_vec, ack);
        intr, reti, int_vec, ack,
 
//registers
 
        ie, tcon, ip);
 
 
input [7:0] wr_addr, data_in, rd_addr;
input [7:0] wr_addr, data_in;
input wr, tf0, tf1, t2_int, ie0, ie1, clk, rst, reti, wr_bit, bit_in, ack, uart_int;
input wr, tf0, tf1, t2_int, ie0, ie1, clk, rst, reti, wr_bit, bit_in, ack, uart_int;
 
 
output tr0, tr1, intr, bit_out;
output tr0, tr1, intr;
output [7:0] int_vec, data_out;
output [7:0] int_vec,
 
             ie,
 
             tcon,
 
             ip;
 
 
reg [7:0] ip, ie, int_vec, data_out;
reg [7:0] ip, ie, int_vec;
 
 
reg [3:0] tcon_s;
reg [3:0] tcon_s;
reg tcon_tf1, tcon_tf0, tcon_ie1, tcon_ie0, bit_out;
reg tcon_tf1, tcon_tf0, tcon_ie1, tcon_ie0;
wire [7:0] tcon;
 
 
 
//
//
// isrc         processing interrupt sources
// isrc         processing interrupt sources
// int_dept
// int_dept
wire [2:0] isrc_cur;
wire [2:0] isrc_cur;
Line 244... Line 254...
// ie1 (tmod.3)
// ie1 (tmod.3)
//
//
always @(posedge clk or posedge rst)
always @(posedge clk or posedge rst)
begin
begin
 if (rst) begin
 if (rst) begin
//   tcon_ie1 <=#1 `OC8051_RST_TCON[3];
 
   tcon_ie1 <=#1 1'b0;
   tcon_ie1 <=#1 1'b0;
 end else if ((wr) & !(wr_bit) & (wr_addr==`OC8051_SFR_TCON)) begin
 end else if ((wr) & !(wr_bit) & (wr_addr==`OC8051_SFR_TCON)) begin
   tcon_ie1 <= #1 data_in[3];
   tcon_ie1 <= #1 data_in[3];
 end else if ((wr) & (wr_bit) & (wr_addr=={`OC8051_SFR_B_TCON, 3'b011})) begin
 end else if ((wr) & (wr_bit) & (wr_addr=={`OC8051_SFR_B_TCON, 3'b011})) begin
   tcon_ie1 <= #1 bit_in;
   tcon_ie1 <= #1 bit_in;
Line 329... Line 338...
 end
 end
end
end
 
 
 
 
always @(posedge clk or posedge rst)
always @(posedge clk or posedge rst)
begin
 
  if (rst) data_out <= #1 8'h0;
 
  else if (wr & !wr_bit & (wr_addr==rd_addr) & (
 
     (wr_addr==`OC8051_SFR_IP) | (wr_addr==`OC8051_SFR_IE) | (wr_addr==`OC8051_SFR_TCON))) begin
 
    data_out <= #1 data_in;
 
  end else begin
 
    case (rd_addr)
 
      `OC8051_SFR_IP: data_out <= #1 ip;
 
      `OC8051_SFR_IE: data_out <= #1 ie0;
 
      default: data_out <= #1 tcon;
 
    endcase
 
  end
 
end
 
 
 
always @(posedge clk or posedge rst)
 
  if (rst) begin
  if (rst) begin
    tf0_buff <= #1 1'b0;
    tf0_buff <= #1 1'b0;
    tf1_buff <= #1 1'b0;
    tf1_buff <= #1 1'b0;
    ie0_buff <= #1 1'b0;
    ie0_buff <= #1 1'b0;
    ie1_buff <= #1 1'b0;
    ie1_buff <= #1 1'b0;
Line 356... Line 350...
    tf1_buff <= #1 tf1;
    tf1_buff <= #1 tf1;
    ie0_buff <= #1 ie0;
    ie0_buff <= #1 ie0;
    ie1_buff <= #1 ie1;
    ie1_buff <= #1 ie1;
  end
  end
 
 
always @(posedge clk or posedge rst)
 
begin
 
  if (rst) bit_out <= #1 1'b0;
 
  else if (wr & wr_bit & (wr_addr==rd_addr)) begin
 
    bit_out <= #1 bit_in;
 
  end else if ((rd_addr[7:3]==wr_addr[7:3]) & wr & !wr_bit) begin
 
    bit_out <= #1 data_in[rd_addr[2:0]];
 
  end else begin
 
    case (rd_addr[7:3])
 
      `OC8051_SFR_B_IP: bit_out <= #1 ip[rd_addr[2:0]];
 
      `OC8051_SFR_B_IE: bit_out <= #1 ie[rd_addr[2:0]];
 
      default: bit_out <= #1 tcon[rd_addr[2:0]];
 
    endcase
 
  end
 
end
 
 
 
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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