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

Subversion Repositories apbi2c

[/] [apbi2c/] [trunk/] [rtl/] [apb.v] - Diff between revs 12 and 24

Show entire file | Details | Blame | View Log

Rev 12 Rev 24
Line 95... Line 95...
                        //external pin
                        //external pin
                        output [31:0] PRDATA,
                        output [31:0] PRDATA,
 
 
                        //internal pin 
                        //internal pin 
                        output reg [13:0] INTERNAL_I2C_REGISTER_CONFIG,
                        output reg [13:0] INTERNAL_I2C_REGISTER_CONFIG,
 
                        output reg [13:0] INTERNAL_I2C_REGISTER_TIMEOUT,
                        output [31:0] WRITE_DATA_ON_TX,
                        output [31:0] WRITE_DATA_ON_TX,
                        output  WR_ENA,
                        output  WR_ENA,
                        output  RD_ENA,
                        output  RD_ENA,
 
 
                        //outside port 
                        //outside port 
Line 117... Line 118...
 
 
//ENABLE READ ON RX FIFO
//ENABLE READ ON RX FIFO
assign RD_ENA = (PWRITE == 1'b0 & PENABLE == 1'b1  & PADDR == 32'd4 & PSELx == 1'b1)?  1'b1:1'b0;
assign RD_ENA = (PWRITE == 1'b0 & PENABLE == 1'b1  & PADDR == 32'd4 & PSELx == 1'b1)?  1'b1:1'b0;
 
 
//WRITE ON I2C MODULE
//WRITE ON I2C MODULE
assign PREADY = ((WR_ENA == 1'b1 | RD_ENA == 1'b1 | PADDR == 32'd8) &  (PENABLE == 1'b1 & PSELx == 1'b1))? 1'b1:1'b0;
assign PREADY = ((WR_ENA == 1'b1 | RD_ENA == 1'b1 | PADDR == 32'd8 | PADDR == 32'd12) &  (PENABLE == 1'b1 & PSELx == 1'b1))? 1'b1:1'b0;
 
 
//INPUT TO WRITE ON TX FIFO
//INPUT TO WRITE ON TX FIFO
assign WRITE_DATA_ON_TX = (PADDR == 32'd0)? PWDATA:PWDATA;
assign WRITE_DATA_ON_TX = (PADDR == 32'd0)? PWDATA:PWDATA;
 
 
//OUTPUT DATA FROM RX TO PRDATA
//OUTPUT DATA FROM RX TO PRDATA
Line 141... Line 142...
begin
begin
 
 
        if(!PRESETn)
        if(!PRESETn)
        begin
        begin
                INTERNAL_I2C_REGISTER_CONFIG <= 14'd0;
                INTERNAL_I2C_REGISTER_CONFIG <= 14'd0;
 
                INTERNAL_I2C_REGISTER_TIMEOUT <= 14'd0;
        end
        end
        else
        else
        begin
        begin
 
 
                // Set configuration to i2c
                // Set configuration to i2c
                if(PADDR == 32'd8 && PSELx == 1'b1 && PWRITE == 1'b1 && PREADY == 1'b1)
                if(PADDR == 32'd8 && PSELx == 1'b1 && PWRITE == 1'b1 && PREADY == 1'b1)
                begin
                begin
                        INTERNAL_I2C_REGISTER_CONFIG <= PWDATA[13:0];
                        INTERNAL_I2C_REGISTER_CONFIG <= PWDATA[13:0];
                end
                end
 
                else if(PADDR == 32'd12 && PSELx == 1'b1 && PWRITE == 1'b1 && PREADY == 1'b1)
 
                begin
 
                        INTERNAL_I2C_REGISTER_TIMEOUT <= PWDATA[13:0];
 
                end
                else
                else
                begin
                begin
                        INTERNAL_I2C_REGISTER_CONFIG <= INTERNAL_I2C_REGISTER_CONFIG;
                        INTERNAL_I2C_REGISTER_CONFIG <= INTERNAL_I2C_REGISTER_CONFIG;
                end
                end
 
 

powered by: WebSVN 2.1.0

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