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

Subversion Repositories pci

[/] [pci/] [tags/] [asyst_2/] [rtl/] [verilog/] [pci_parity_check.v] - Diff between revs 6 and 21

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

Rev 6 Rev 21
Line 40... Line 40...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.2  2001/10/05 08:14:30  mihad
 
// Updated all files with inclusion of timescale file for simulation purposes.
 
//
// Revision 1.1.1.1  2001/10/02 15:33:47  mihad
// Revision 1.1.1.1  2001/10/02 15:33:47  mihad
// New project directory structure
// New project directory structure
//
//
//
//
 
 
`include "constants.v"
// synopsys translate_off
`include "timescale.v"
`include "timescale.v"
 
// synopsys translate_on
 
`include "pci_constants.v"
 
`include "bus_commands.v"
 
 
module PCI_PARITY_CHECK
module PCI_PARITY_CHECK
(
(
    reset_in,
    reset_in,
    clk_in,
    clk_in,
Line 73... Line 79...
    pci_trdy_en_in,
    pci_trdy_en_in,
    pci_par_en_in,
    pci_par_en_in,
    pci_ad_out_in,
    pci_ad_out_in,
    pci_ad_reg_in,
    pci_ad_reg_in,
    pci_cbe_in_in,
    pci_cbe_in_in,
 
    pci_cbe_reg_in,
    pci_cbe_out_in,
    pci_cbe_out_in,
    pci_cbe_en_in,
    pci_cbe_en_in,
    pci_ad_en_in,
    pci_ad_en_in,
    par_err_response_in,
    par_err_response_in,
    par_err_detect_out,
    par_err_detect_out,
Line 111... Line 118...
input           pci_trdy_en_in ;        // target ready output enable
input           pci_trdy_en_in ;        // target ready output enable
input           pci_par_en_in ;         // par enable input
input           pci_par_en_in ;         // par enable input
input [31:0]    pci_ad_out_in ;         // data driven by bridge to PCI
input [31:0]    pci_ad_out_in ;         // data driven by bridge to PCI
input [31:0]    pci_ad_reg_in ;          // data driven by other agents on PCI
input [31:0]    pci_ad_reg_in ;          // data driven by other agents on PCI
input [3:0]     pci_cbe_in_in ;         // cbe driven by outside agents
input [3:0]     pci_cbe_in_in ;         // cbe driven by outside agents
 
input [3:0]     pci_cbe_reg_in ;        // registered cbe driven by outside agents
input [3:0]     pci_cbe_out_in ;        // cbe driven by pci master state machine
input [3:0]     pci_cbe_out_in ;        // cbe driven by pci master state machine
input           pci_ad_en_in ;          // ad enable input
input           pci_ad_en_in ;          // ad enable input
input           par_err_response_in ;   // parity error response bit from conf.space
input           par_err_response_in ;   // parity error response bit from conf.space
output          par_err_detect_out ;    // parity error detected signal out
output          par_err_detect_out ;    // parity error detected signal out
output          perr_mas_detect_out ;   // master asserted PERR or sampled PERR asserted
output          perr_mas_detect_out ;   // master asserted PERR or sampled PERR asserted
Line 125... Line 133...
// FFs for frame input - used for determining whether PAR is sampled for address phase or for data phase
// FFs for frame input - used for determining whether PAR is sampled for address phase or for data phase
reg     frame_dec2 ;
reg     frame_dec2 ;
reg check_perr ;
reg check_perr ;
 
 
/*=======================================================================================================================
/*=======================================================================================================================
Input and output data sampling - used by parity checking and generation logic
CBE lines' parity is needed for overall parity calculation
=======================================================================================================================*/
=======================================================================================================================*/
wire par_cbe_out = pci_cbe_out_in[3] ^^ pci_cbe_out_in[2] ^^ pci_cbe_out_in[1] ^^ pci_cbe_out_in[0] ;
wire par_cbe_out = pci_cbe_out_in[3] ^^ pci_cbe_out_in[2] ^^ pci_cbe_out_in[1] ^^ pci_cbe_out_in[0] ;
wire par_cbe_include ;
wire par_cbe_in  = pci_cbe_reg_in[3] ^^ pci_cbe_reg_in[2] ^^ pci_cbe_reg_in[1] ^^ pci_cbe_reg_in[0] ;
 
 
PAR_CBE_CRIT cbe_par_calc
 
(
 
    .par_cbe_include_out(par_cbe_include),
 
    .par_cbe_out_in     (par_cbe_out),
 
    .par_cbe_en_in      (pci_cbe_en_in),
 
    .pci_cbe_in         (pci_cbe_in_in)
 
) ;
 
 
 
reg  cbe_par_reg ;
 
always@( posedge reset_in or posedge clk_in )
 
begin
 
    if (reset_in)
 
        cbe_par_reg <= #`FF_DELAY 1'b0 ;
 
    else
 
        cbe_par_reg <= #`FF_DELAY par_cbe_include ;
 
end
 
 
 
/*=======================================================================================================================
/*=======================================================================================================================
Parity generator - parity is generated and assigned to output on every clock edge. PAR output enable is active
Parity generator - parity is generated and assigned to output on every clock edge. PAR output enable is active
one clock cycle after data output enable. Depending on whether master is performing access or target is responding,
one clock cycle after data output enable. Depending on whether master is performing access or target is responding,
apropriate cbe data is included in parity generation.
apropriate cbe data is included in parity generation. Non - registered CBE is used during reads through target SM
=======================================================================================================================*/
=======================================================================================================================*/
 
 
// generate appropriate par signal
// generate appropriate par signal
wire data_par = (pci_ad_out_in[31] ^^ pci_ad_out_in[30] ^^ pci_ad_out_in[29] ^^ pci_ad_out_in[28]) ^^
wire data_par = (pci_ad_out_in[31] ^^ pci_ad_out_in[30] ^^ pci_ad_out_in[29] ^^ pci_ad_out_in[28]) ^^
                (pci_ad_out_in[27] ^^ pci_ad_out_in[26] ^^ pci_ad_out_in[25] ^^ pci_ad_out_in[24]) ^^
                (pci_ad_out_in[27] ^^ pci_ad_out_in[26] ^^ pci_ad_out_in[25] ^^ pci_ad_out_in[24]) ^^
Line 164... Line 155...
                (pci_ad_out_in[11] ^^ pci_ad_out_in[10] ^^ pci_ad_out_in[9]  ^^ pci_ad_out_in[8])  ^^
                (pci_ad_out_in[11] ^^ pci_ad_out_in[10] ^^ pci_ad_out_in[9]  ^^ pci_ad_out_in[8])  ^^
                (pci_ad_out_in[7]  ^^ pci_ad_out_in[6]  ^^ pci_ad_out_in[5]  ^^ pci_ad_out_in[4])  ^^
                (pci_ad_out_in[7]  ^^ pci_ad_out_in[6]  ^^ pci_ad_out_in[5]  ^^ pci_ad_out_in[4])  ^^
                (pci_ad_out_in[3]  ^^ pci_ad_out_in[2]  ^^ pci_ad_out_in[1]  ^^ pci_ad_out_in[0]) ;
                (pci_ad_out_in[3]  ^^ pci_ad_out_in[2]  ^^ pci_ad_out_in[1]  ^^ pci_ad_out_in[0]) ;
 
 
wire par_out_only = data_par ^^ par_cbe_out ;
wire par_out_only = data_par ^^ par_cbe_out ;
 
 
PAR_CRIT par_gen
PAR_CRIT par_gen
(
(
    .par_out        (pci_par_out),
    .par_out        (pci_par_out),
    .par_out_in     (par_out_only),
    .par_out_in     (par_out_only),
    .pci_cbe_en_in  (pci_cbe_en_in),
    .pci_cbe_en_in  (pci_cbe_en_in),
Line 208... Line 200...
assign pci_perr_out = perr_n ;
assign pci_perr_out = perr_n ;
 
 
// parity error output assignment
// parity error output assignment
//assign pci_perr_out = ~(perr && perr_generate) ;
//assign pci_perr_out = ~(perr && perr_generate) ;
 
 
wire non_critical_par = cbe_par_reg ^^ data_in_par ;
wire non_critical_par = par_cbe_in ^^ data_in_par ;
 
 
PERR_CRIT perr_crit_gen
PERR_CRIT perr_crit_gen
(
(
    .perr_out           (perr),
    .perr_out           (perr),
    .perr_n_out         (perr_n),
    .perr_n_out         (perr_n),
Line 239... Line 231...
always@(posedge reset_in or posedge clk_in)
always@(posedge reset_in or posedge clk_in)
begin
begin
    if (reset_in)
    if (reset_in)
        frame_dec2 <= #`FF_DELAY 1'b0 ;
        frame_dec2 <= #`FF_DELAY 1'b0 ;
    else
    else
        frame_dec2 <= #`FF_DELAY pci_frame_reg_in && ~pci_frame_en_in ;
        frame_dec2 <= #`FF_DELAY pci_frame_reg_in ;
end
end
 
 
// address phase parity indicator
// address phase parity error checking - done after address phase is detected - which is - when bridge's master is not driving frame,
wire check_for_serr = ~pci_frame_reg_in && frame_dec2 ;
// frame was asserted on previous cycle and was not asserted two cycles before.
 
wire check_for_serr_on_first = ~pci_frame_reg_in && frame_dec2  && ~pci_frame_en_in ;
 
 
 
reg  check_for_serr_on_second ;
 
always@(posedge reset_in or posedge clk_in)
 
begin
 
    if ( reset_in )
 
        check_for_serr_on_second <= #`FF_DELAY 1'b0 ;
 
    else
 
        check_for_serr_on_second <= #`FF_DELAY check_for_serr_on_first && ( pci_cbe_reg_in == `BC_DUAL_ADDR_CYC ) ;
 
end
 
 
 
wire check_for_serr = check_for_serr_on_first || check_for_serr_on_second ;
 
 
wire serr_generate  = check_for_serr && serr_enable_in && par_err_response_in ;
wire serr_generate  = check_for_serr && serr_enable_in && par_err_response_in ;
 
 
SERR_EN_CRIT serr_en_crit_gen
SERR_EN_CRIT serr_en_crit_gen
(
(
    .serr_en_out        (pci_serr_en_out),
    .serr_en_out        (pci_serr_en_out),
Line 293... Line 298...
 
 
// assign output for parity error detected bit
// assign output for parity error detected bit
assign par_err_detect_out = ~pci_serr_out_in || ~pci_perr_out_in || perr_sampled ;
assign par_err_detect_out = ~pci_serr_out_in || ~pci_perr_out_in || perr_sampled ;
 
 
// FF indicating that that last operation was done as bus master
// FF indicating that that last operation was done as bus master
 
reg frame_and_irdy_en_prev      ;
 
reg frame_and_irdy_en_prev_prev ;
reg master_perr_report ;
reg master_perr_report ;
always@(posedge reset_in or posedge clk_in)
always@(posedge reset_in or posedge clk_in)
begin
begin
    if ( reset_in )
    if ( reset_in )
 
    begin
        master_perr_report <= #`FF_DELAY 1'b0 ;
        master_perr_report <= #`FF_DELAY 1'b0 ;
 
        frame_and_irdy_en_prev      <= #`FF_DELAY 1'b0 ;
 
        frame_and_irdy_en_prev_prev <= #`FF_DELAY 1'b0 ;
 
    end
    else
    else
        master_perr_report <= #`FF_DELAY pci_irdy_en_in ;
    begin
 
        master_perr_report          <= #`FF_DELAY frame_and_irdy_en_prev_prev ;
 
        frame_and_irdy_en_prev      <= #`FF_DELAY pci_irdy_en_in && pci_frame_en_in ;
 
        frame_and_irdy_en_prev_prev <= #`FF_DELAY frame_and_irdy_en_prev ;
 
    end
end
end
 
 
assign perr_mas_detect_out = master_perr_report && ( (par_err_response_in && perr_sampled) || pci_perr_en_reg ) ;
assign perr_mas_detect_out = master_perr_report && ( (par_err_response_in && perr_sampled) || pci_perr_en_reg ) ;
 
 
endmodule
endmodule
 No newline at end of file
 No newline at end of file
 
 
 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.