//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// File name "wb_bus_mon.v" ////
|
//// File name "wb_bus_mon.v" ////
|
//// ////
|
//// ////
|
//// This file is part of the Ethernet IP core project ////
|
//// This file is part of the Ethernet IP core project ////
|
//// http://www.opencores.org/projects/ethmac/ ////
|
//// http://www.opencores.org/projects/ethmac/ ////
|
//// ////
|
//// ////
|
//// Author(s): ////
|
//// Author(s): ////
|
//// - Miha Dolenc (mihad@opencores.org) ////
|
//// - Miha Dolenc (mihad@opencores.org) ////
|
//// ////
|
//// ////
|
//// All additional information is available in the README.pdf ////
|
//// All additional information is available in the README.pdf ////
|
//// file. ////
|
//// file. ////
|
//// ////
|
//// ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2002 Authors ////
|
//// Copyright (C) 2002 Authors ////
|
//// ////
|
//// ////
|
//// 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 ////
|
//// removed from the file and that any derivative work contains ////
|
//// removed from the file and that any derivative work contains ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.2 2002/09/13 12:29:14 mohor
|
|
// Headers changed.
|
|
//
|
// Revision 1.1 2002/09/13 11:57:20 mohor
|
// Revision 1.1 2002/09/13 11:57:20 mohor
|
// New testbench. Thanks to Tadej M - "The Spammer".
|
// New testbench. Thanks to Tadej M - "The Spammer".
|
//
|
//
|
// Revision 1.1 2002/02/01 13:39:43 mihad
|
// Revision 1.1 2002/02/01 13:39:43 mihad
|
// Initial testbench import. Still under development
|
// Initial testbench import. Still under development
|
//
|
//
|
// Revision 1.1 2001/08/06 18:12:58 mihad
|
// Revision 1.1 2001/08/06 18:12:58 mihad
|
// Pocasi delamo kompletno zadevo
|
// Pocasi delamo kompletno zadevo
|
//
|
//
|
//
|
//
|
|
|
|
`include "timescale.v"
|
`include "wb_model_defines.v"
|
`include "wb_model_defines.v"
|
// WISHBONE bus monitor module - it connects to WISHBONE master signals and
|
// WISHBONE bus monitor module - it connects to WISHBONE master signals and
|
// monitors for any illegal combinations appearing on the bus.
|
// monitors for any illegal combinations appearing on the bus.
|
module WB_BUS_MON(
|
module WB_BUS_MON(
|
CLK_I,
|
CLK_I,
|
RST_I,
|
RST_I,
|
ACK_I,
|
ACK_I,
|
ADDR_O,
|
ADDR_O,
|
CYC_O,
|
CYC_O,
|
DAT_I,
|
DAT_I,
|
DAT_O,
|
DAT_O,
|
ERR_I,
|
ERR_I,
|
RTY_I,
|
RTY_I,
|
SEL_O,
|
SEL_O,
|
STB_O,
|
STB_O,
|
WE_O,
|
WE_O,
|
TAG_I,
|
TAG_I,
|
TAG_O,
|
TAG_O,
|
CAB_O,
|
CAB_O,
|
log_file_desc
|
log_file_desc
|
) ;
|
) ;
|
|
|
input CLK_I ;
|
input CLK_I ;
|
input RST_I ;
|
input RST_I ;
|
input ACK_I ;
|
input ACK_I ;
|
input [(`WB_ADDR_WIDTH-1):0] ADDR_O ;
|
input [(`WB_ADDR_WIDTH-1):0] ADDR_O ;
|
input CYC_O ;
|
input CYC_O ;
|
input [(`WB_DATA_WIDTH-1):0] DAT_I ;
|
input [(`WB_DATA_WIDTH-1):0] DAT_I ;
|
input [(`WB_DATA_WIDTH-1):0] DAT_O ;
|
input [(`WB_DATA_WIDTH-1):0] DAT_O ;
|
input ERR_I ;
|
input ERR_I ;
|
input RTY_I ;
|
input RTY_I ;
|
input [(`WB_SEL_WIDTH-1):0] SEL_O ;
|
input [(`WB_SEL_WIDTH-1):0] SEL_O ;
|
input STB_O ;
|
input STB_O ;
|
input WE_O ;
|
input WE_O ;
|
input [(`WB_TAG_WIDTH-1):0] TAG_I ;
|
input [(`WB_TAG_WIDTH-1):0] TAG_I ;
|
input [(`WB_TAG_WIDTH-1):0] TAG_O ;
|
input [(`WB_TAG_WIDTH-1):0] TAG_O ;
|
input CAB_O ;
|
input CAB_O ;
|
input [31:0] log_file_desc ;
|
input [31:0] log_file_desc ;
|
|
|
always@(posedge CLK_I or posedge RST_I)
|
always@(posedge CLK_I or posedge RST_I)
|
begin
|
begin
|
if (RST_I)
|
if (RST_I)
|
begin
|
begin
|
// when reset is applied, all control signals must be low
|
// when reset is applied, all control signals must be low
|
if (CYC_O)
|
if (CYC_O)
|
begin
|
begin
|
$display("*E (%0t) CYC_O active under reset", $time) ;
|
$display("*E (%0t) CYC_O active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)CYC_O active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)CYC_O active under reset", $time) ;
|
end
|
end
|
if (STB_O)
|
if (STB_O)
|
begin
|
begin
|
$display("*E (%0t) STB_O active under reset", $time) ;
|
$display("*E (%0t) STB_O active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)STB_O active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)STB_O active under reset", $time) ;
|
end
|
end
|
/*if (ACK_I)
|
/*if (ACK_I)
|
$display("ACK_I active under reset") ;*/
|
$display("ACK_I active under reset") ;*/
|
if (ERR_I)
|
if (ERR_I)
|
begin
|
begin
|
$display("*E (%0t) ERR_I active under reset", $time) ;
|
$display("*E (%0t) ERR_I active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ERR_I active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ERR_I active under reset", $time) ;
|
end
|
end
|
if (RTY_I)
|
if (RTY_I)
|
begin
|
begin
|
$display("*E (%0t) RTY_I active under reset", $time) ;
|
$display("*E (%0t) RTY_I active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)RTY_I active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)RTY_I active under reset", $time) ;
|
end
|
end
|
if (CAB_O)
|
if (CAB_O)
|
begin
|
begin
|
$display("*E (%0t) CAB_O active under reset", $time) ;
|
$display("*E (%0t) CAB_O active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)CAB_O active under reset", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)CAB_O active under reset", $time) ;
|
end
|
end
|
end // reset
|
end // reset
|
else
|
else
|
if (~CYC_O)
|
if (~CYC_O)
|
begin
|
begin
|
// when cycle indicator is low, all control signals must be low
|
// when cycle indicator is low, all control signals must be low
|
if (STB_O)
|
if (STB_O)
|
begin
|
begin
|
$display("*E (%0t) STB_O active without CYC_O being active", $time) ;
|
$display("*E (%0t) STB_O active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)STB_O active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)STB_O active without CYC_O being active", $time) ;
|
end
|
end
|
if (ACK_I)
|
if (ACK_I)
|
begin
|
begin
|
$display("*E (%0t) ACK_I active without CYC_O being active", $time) ;
|
$display("*E (%0t) ACK_I active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ACK_I active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ACK_I active without CYC_O being active", $time) ;
|
end
|
end
|
if (ERR_I)
|
if (ERR_I)
|
begin
|
begin
|
$display("*E (%0t) ERR_I active without CYC_O being active", $time) ;
|
$display("*E (%0t) ERR_I active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ERR_I active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ERR_I active without CYC_O being active", $time) ;
|
end
|
end
|
if (RTY_I)
|
if (RTY_I)
|
begin
|
begin
|
$display("*E (%0t) RTY_I active without CYC_O being active", $time) ;
|
$display("*E (%0t) RTY_I active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)RTY_I active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)RTY_I active without CYC_O being active", $time) ;
|
end
|
end
|
if (CAB_O)
|
if (CAB_O)
|
begin
|
begin
|
$display("*E (%0t) CAB_O active without CYC_O being active", $time) ;
|
$display("*E (%0t) CAB_O active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)CAB_O active without CYC_O being active", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)CAB_O active without CYC_O being active", $time) ;
|
end
|
end
|
end // ~CYC_O
|
end // ~CYC_O
|
end
|
end
|
|
|
reg [`WB_DATA_WIDTH-1:0] previous_data ;
|
reg [`WB_DATA_WIDTH-1:0] previous_data ;
|
reg [`WB_ADDR_WIDTH-1:0] previous_address ;
|
reg [`WB_ADDR_WIDTH-1:0] previous_address ;
|
reg [`WB_SEL_WIDTH-1:0] previous_sel ;
|
reg [`WB_SEL_WIDTH-1:0] previous_sel ;
|
reg previous_stb ;
|
reg previous_stb ;
|
reg previous_ack ;
|
reg previous_ack ;
|
reg previous_err ;
|
reg previous_err ;
|
reg previous_rty ;
|
reg previous_rty ;
|
reg previous_cyc ;
|
reg previous_cyc ;
|
reg can_change ;
|
reg can_change ;
|
|
|
always@(posedge CLK_I or posedge RST_I)
|
always@(posedge CLK_I or posedge RST_I)
|
begin
|
begin
|
if (RST_I)
|
if (RST_I)
|
begin
|
begin
|
previous_stb <= 1'b0 ;
|
previous_stb <= 1'b0 ;
|
previous_ack <= 1'b0 ;
|
previous_ack <= 1'b0 ;
|
previous_err <= 1'b0 ;
|
previous_err <= 1'b0 ;
|
previous_rty <= 1'b0 ;
|
previous_rty <= 1'b0 ;
|
previous_cyc <= 1'b0 ;
|
previous_cyc <= 1'b0 ;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
previous_stb <= STB_O ;
|
previous_stb <= STB_O ;
|
previous_ack <= ACK_I ;
|
previous_ack <= ACK_I ;
|
previous_err <= ERR_I ;
|
previous_err <= ERR_I ;
|
previous_rty <= RTY_I ;
|
previous_rty <= RTY_I ;
|
previous_cyc <= CYC_O ;
|
previous_cyc <= CYC_O ;
|
end
|
end
|
end
|
end
|
|
|
// cycle monitor
|
// cycle monitor
|
always@(posedge CLK_I)
|
always@(posedge CLK_I)
|
begin
|
begin
|
if (CYC_O && ~RST_I) // cycle in progress
|
if (CYC_O && ~RST_I) // cycle in progress
|
begin
|
begin
|
if (STB_O)
|
if (STB_O)
|
begin
|
begin
|
// check for two control signals active at same edge
|
// check for two control signals active at same edge
|
if ( ACK_I && RTY_I )
|
if ( ACK_I && RTY_I )
|
begin
|
begin
|
$display("*E (%0t) ACK_I and RTY_I asserted at the same time during cycle", $time) ;
|
$display("*E (%0t) ACK_I and RTY_I asserted at the same time during cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ACK_I and RTY_I asserted at the same time during cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ACK_I and RTY_I asserted at the same time during cycle", $time) ;
|
end
|
end
|
if ( ACK_I && ERR_I )
|
if ( ACK_I && ERR_I )
|
begin
|
begin
|
$display("*E (%0t) ACK_I and ERR_I asserted at the same time during cycle", $time) ;
|
$display("*E (%0t) ACK_I and ERR_I asserted at the same time during cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ACK_I and ERR_I asserted at the same time during cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ACK_I and ERR_I asserted at the same time during cycle", $time) ;
|
end
|
end
|
if ( RTY_I && ERR_I )
|
if ( RTY_I && ERR_I )
|
begin
|
begin
|
$display("*E (%0t) RTY_I and ERR_I asserted at the same time during cycle", $time) ;
|
$display("*E (%0t) RTY_I and ERR_I asserted at the same time during cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)RTY_I and ERR_I asserted at the same time during cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)RTY_I and ERR_I asserted at the same time during cycle", $time) ;
|
end
|
end
|
|
|
if ( can_change !== 1 )
|
if ( can_change !== 1 )
|
begin
|
begin
|
if ( ADDR_O !== previous_address )
|
if ( ADDR_O !== previous_address )
|
begin
|
begin
|
$display("*E (%0t) WB bus monitor detected address change in the middle of the cycle!", $time) ;
|
$display("*E (%0t) WB bus monitor detected address change in the middle of the cycle!", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)WB bus monitor detected address change in the middle of the cycle!", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)WB bus monitor detected address change in the middle of the cycle!", $time) ;
|
end
|
end
|
|
|
if ( SEL_O !== previous_sel )
|
if ( SEL_O !== previous_sel )
|
begin
|
begin
|
$display("*E (%0t) WB bus monitor detected select lines changed in the middle of the cycle!", $time) ;
|
$display("*E (%0t) WB bus monitor detected select lines changed in the middle of the cycle!", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)WB bus monitor detected select lines changed in the middle of the cycle!", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)WB bus monitor detected select lines changed in the middle of the cycle!", $time) ;
|
end
|
end
|
|
|
if ( (WE_O !== 0) && ( DAT_O !== previous_data ) )
|
if ( (WE_O !== 0) && ( DAT_O !== previous_data ) )
|
begin
|
begin
|
$display("*E (%0t) WB bus monitor detected data lines changed in the middle of the cycle!", $time) ;
|
$display("*E (%0t) WB bus monitor detected data lines changed in the middle of the cycle!", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)WB bus monitor detected data lines changed in the middle of the cycle!", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)WB bus monitor detected data lines changed in the middle of the cycle!", $time) ;
|
end
|
end
|
end
|
end
|
|
|
if ( ACK_I || RTY_I || ERR_I )
|
if ( ACK_I || RTY_I || ERR_I )
|
can_change = 1 ;
|
can_change = 1 ;
|
else
|
else
|
begin
|
begin
|
previous_data = DAT_O ;
|
previous_data = DAT_O ;
|
previous_address = ADDR_O ;
|
previous_address = ADDR_O ;
|
previous_sel = SEL_O ;
|
previous_sel = SEL_O ;
|
can_change = 0 ;
|
can_change = 0 ;
|
end
|
end
|
|
|
end // STB_O
|
end // STB_O
|
else
|
else
|
begin //~STB_O
|
begin //~STB_O
|
// while STB_O is inactive, only ACK_I is allowed to be active
|
// while STB_O is inactive, only ACK_I is allowed to be active
|
if ( ERR_I )
|
if ( ERR_I )
|
begin
|
begin
|
$display("*E (%0t) ERR_I asserted during cycle without STB_O", $time) ;
|
$display("*E (%0t) ERR_I asserted during cycle without STB_O", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ERR_I asserted during cycle without STB_O", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)ERR_I asserted during cycle without STB_O", $time) ;
|
end
|
end
|
if ( RTY_I )
|
if ( RTY_I )
|
begin
|
begin
|
$display("*E (%0t) RTY_I asserted during cycle without STB_O", $time) ;
|
$display("*E (%0t) RTY_I asserted during cycle without STB_O", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)RTY_I asserted during cycle without STB_O", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)RTY_I asserted during cycle without STB_O", $time) ;
|
end
|
end
|
|
|
if ((previous_ack !== 1) && (previous_err !== 1) && (previous_rty !== 1) && (previous_stb !== 0))
|
if ((previous_ack !== 1) && (previous_err !== 1) && (previous_rty !== 1) && (previous_stb !== 0))
|
begin
|
begin
|
$display("STB_O de-asserted without reception of slave response") ;
|
$display("STB_O de-asserted without reception of slave response") ;
|
$fdisplay(log_file_desc, "STB_O de-asserted without reception of slave response") ;
|
$fdisplay(log_file_desc, "STB_O de-asserted without reception of slave response") ;
|
end
|
end
|
|
|
can_change = 1 ;
|
can_change = 1 ;
|
end // ~STB_O
|
end // ~STB_O
|
end // cycle in progress
|
end // cycle in progress
|
else if (!RST_I)
|
else if (!RST_I)
|
begin
|
begin
|
// cycle not in progress anymore
|
// cycle not in progress anymore
|
can_change = 1 ;
|
can_change = 1 ;
|
if ((previous_ack !== 1) && (previous_err !== 1) && (previous_rty !== 1) && (previous_stb !== 0))
|
if ((previous_ack !== 1) && (previous_err !== 1) && (previous_rty !== 1) && (previous_stb !== 0))
|
begin
|
begin
|
$display("STB_O de-asserted without reception of slave response") ;
|
$display("STB_O de-asserted without reception of slave response") ;
|
$fdisplay(log_file_desc, "STB_O de-asserted without reception of slave response") ;
|
$fdisplay(log_file_desc, "STB_O de-asserted without reception of slave response") ;
|
end
|
end
|
end
|
end
|
end // cycle monitor
|
end // cycle monitor
|
|
|
// CAB_O monitor - CAB_O musn't change during one cycle
|
// CAB_O monitor - CAB_O musn't change during one cycle
|
reg [1:0] first_cab_val ;
|
reg [1:0] first_cab_val ;
|
always@(posedge CLK_I or RST_I)
|
always@(posedge CLK_I or RST_I)
|
begin
|
begin
|
if ((CYC_O === 0) || RST_I)
|
if ((CYC_O === 0) || RST_I)
|
first_cab_val <= 2'b00 ;
|
first_cab_val <= 2'b00 ;
|
else
|
else
|
begin
|
begin
|
// cycle in progress - is this first clock edge in a cycle ?
|
// cycle in progress - is this first clock edge in a cycle ?
|
if (first_cab_val[1] === 1'b0)
|
if (first_cab_val[1] === 1'b0)
|
first_cab_val <= {1'b1, CAB_O} ;
|
first_cab_val <= {1'b1, CAB_O} ;
|
else if ( first_cab_val[0] !== CAB_O )
|
else if ( first_cab_val[0] !== CAB_O )
|
begin
|
begin
|
$display("*E (%0t) CAB_O value changed during cycle", $time) ;
|
$display("*E (%0t) CAB_O value changed during cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)CAB_O value changed during cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)CAB_O value changed during cycle", $time) ;
|
end
|
end
|
end
|
end
|
end // CAB_O monitor
|
end // CAB_O monitor
|
|
|
// WE_O monitor for consecutive address bursts
|
// WE_O monitor for consecutive address bursts
|
reg [1:0] first_we_val ;
|
reg [1:0] first_we_val ;
|
always@(posedge CLK_I or posedge RST_I)
|
always@(posedge CLK_I or posedge RST_I)
|
begin
|
begin
|
if (~CYC_O || ~CAB_O || RST_I)
|
if (~CYC_O || ~CAB_O || RST_I)
|
first_we_val <= 2'b00 ;
|
first_we_val <= 2'b00 ;
|
else
|
else
|
if (STB_O)
|
if (STB_O)
|
begin
|
begin
|
// cycle in progress - is this first clock edge in a cycle ?
|
// cycle in progress - is this first clock edge in a cycle ?
|
if (first_we_val[1] == 1'b0)
|
if (first_we_val[1] == 1'b0)
|
first_we_val <= {1'b1, WE_O} ;
|
first_we_val <= {1'b1, WE_O} ;
|
else if ( first_we_val[0] != WE_O )
|
else if ( first_we_val[0] != WE_O )
|
begin
|
begin
|
$display("*E (%0t) WE_O value changed during CAB cycle", $time) ;
|
$display("*E (%0t) WE_O value changed during CAB cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)WE_O value changed during CAB cycle", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)WE_O value changed during CAB cycle", $time) ;
|
end
|
end
|
end
|
end
|
end // CAB_O monitor
|
end // CAB_O monitor
|
|
|
// address monitor for consecutive address bursts
|
// address monitor for consecutive address bursts
|
reg [`WB_ADDR_WIDTH:0] address ;
|
reg [`WB_ADDR_WIDTH:0] address ;
|
always@(posedge CLK_I or posedge RST_I)
|
always@(posedge CLK_I or posedge RST_I)
|
begin
|
begin
|
if (~CYC_O || ~CAB_O || RST_I)
|
if (~CYC_O || ~CAB_O || RST_I)
|
address <= {(`WB_ADDR_WIDTH + 1){1'b0}} ;
|
address <= {(`WB_ADDR_WIDTH + 1){1'b0}} ;
|
else
|
else
|
begin
|
begin
|
if (STB_O && ACK_I)
|
if (STB_O && ACK_I)
|
begin
|
begin
|
if (address[`WB_ADDR_WIDTH] == 1'b0)
|
if (address[`WB_ADDR_WIDTH] == 1'b0)
|
address <= {1'b1, (ADDR_O + `WB_SEL_WIDTH)} ;
|
address <= {1'b1, (ADDR_O + `WB_SEL_WIDTH)} ;
|
else
|
else
|
begin
|
begin
|
if ( address[(`WB_ADDR_WIDTH-1):0] != ADDR_O)
|
if ( address[(`WB_ADDR_WIDTH-1):0] != ADDR_O)
|
begin
|
begin
|
$display("*E (%0t) Consecutive address burst address incrementing incorrect", $time) ;
|
$display("*E (%0t) Consecutive address burst address incrementing incorrect", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Consecutive address burst address incrementing incorrect", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Consecutive address burst address incrementing incorrect", $time) ;
|
end
|
end
|
else
|
else
|
address <= {1'b1, (ADDR_O + `WB_SEL_WIDTH)} ;
|
address <= {1'b1, (ADDR_O + `WB_SEL_WIDTH)} ;
|
end
|
end
|
end
|
end
|
end
|
end
|
end // address monitor
|
end // address monitor
|
|
|
// data monitor
|
// data monitor
|
always@(posedge CLK_I or posedge RST_I)
|
always@(posedge CLK_I or posedge RST_I)
|
begin
|
begin
|
if (CYC_O && STB_O && ~RST_I)
|
if (CYC_O && STB_O && ~RST_I)
|
begin
|
begin
|
if ( ((^ADDR_O) !== 1'b1) && ((^ADDR_O) !== 1'b0) )
|
if ( ((^ADDR_O) !== 1'b1) && ((^ADDR_O) !== 1'b0) )
|
begin
|
begin
|
$display("*E (%0t) Master provided invalid address and qualified it with STB_O", $time) ;
|
$display("*E (%0t) Master provided invalid address and qualified it with STB_O", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Master provided invalid address and qualified it with STB_O", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Master provided invalid address and qualified it with STB_O", $time) ;
|
end
|
end
|
if ( WE_O )
|
if ( WE_O )
|
begin
|
begin
|
if (
|
if (
|
(SEL_O[0] && (((^DAT_O[7:0]) !== 1'b0) && ((^DAT_O[7:0]) !== 1'b1))) ||
|
(SEL_O[0] && (((^DAT_O[7:0]) !== 1'b0) && ((^DAT_O[7:0]) !== 1'b1))) ||
|
(SEL_O[1] && (((^DAT_O[15:8]) !== 1'b0) && ((^DAT_O[15:8]) !== 1'b1))) ||
|
(SEL_O[1] && (((^DAT_O[15:8]) !== 1'b0) && ((^DAT_O[15:8]) !== 1'b1))) ||
|
(SEL_O[2] && (((^DAT_O[23:16]) !== 1'b0) && ((^DAT_O[23:16]) !== 1'b1))) ||
|
(SEL_O[2] && (((^DAT_O[23:16]) !== 1'b0) && ((^DAT_O[23:16]) !== 1'b1))) ||
|
(SEL_O[3] && (((^DAT_O[31:24]) !== 1'b0) && ((^DAT_O[31:24]) !== 1'b1)))
|
(SEL_O[3] && (((^DAT_O[31:24]) !== 1'b0) && ((^DAT_O[31:24]) !== 1'b1)))
|
)
|
)
|
begin
|
begin
|
$display("*E (%0t) Master provided invalid data during write and qualified it with STB_O", $time) ;
|
$display("*E (%0t) Master provided invalid data during write and qualified it with STB_O", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Master provided invalid data during write and qualified it with STB_O", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Master provided invalid data during write and qualified it with STB_O", $time) ;
|
$display("*E (%0t) Byte select value: SEL_O = %b, Data bus value: DAT_O = %h ", $time, SEL_O, DAT_O) ;
|
$display("*E (%0t) Byte select value: SEL_O = %b, Data bus value: DAT_O = %h ", $time, SEL_O, DAT_O) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Byte select value: SEL_O = %b, Data bus value: DAT_O = %h ", $time, SEL_O, DAT_O) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Byte select value: SEL_O = %b, Data bus value: DAT_O = %h ", $time, SEL_O, DAT_O) ;
|
end
|
end
|
|
|
end
|
end
|
else
|
else
|
if (~WE_O && ACK_I)
|
if (~WE_O && ACK_I)
|
begin
|
begin
|
if (
|
if (
|
(SEL_O[0] && (((^DAT_I[7:0]) !== 1'b0) && ((^DAT_I[7:0]) !== 1'b1))) ||
|
(SEL_O[0] && (((^DAT_I[7:0]) !== 1'b0) && ((^DAT_I[7:0]) !== 1'b1))) ||
|
(SEL_O[1] && (((^DAT_I[15:8]) !== 1'b0) && ((^DAT_I[15:8]) !== 1'b1))) ||
|
(SEL_O[1] && (((^DAT_I[15:8]) !== 1'b0) && ((^DAT_I[15:8]) !== 1'b1))) ||
|
(SEL_O[2] && (((^DAT_I[23:16]) !== 1'b0) && ((^DAT_I[23:16]) !== 1'b1))) ||
|
(SEL_O[2] && (((^DAT_I[23:16]) !== 1'b0) && ((^DAT_I[23:16]) !== 1'b1))) ||
|
(SEL_O[3] && (((^DAT_I[31:24]) !== 1'b0) && ((^DAT_I[31:24]) !== 1'b1)))
|
(SEL_O[3] && (((^DAT_I[31:24]) !== 1'b0) && ((^DAT_I[31:24]) !== 1'b1)))
|
)
|
)
|
begin
|
begin
|
$display("*E (%0t) Slave provided invalid data during read and qualified it with ACK_I", $time) ;
|
$display("*E (%0t) Slave provided invalid data during read and qualified it with ACK_I", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Slave provided invalid data during read and qualified it with ACK_I", $time) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Slave provided invalid data during read and qualified it with ACK_I", $time) ;
|
$display("*E (%0t) Byte select value: SEL_O = %b, Data bus value: DAT_I = %h ", $time, SEL_O, DAT_I) ;
|
$display("*E (%0t) Byte select value: SEL_O = %b, Data bus value: DAT_I = %h ", $time, SEL_O, DAT_I) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Byte select value: SEL_O = %b, Data bus value: DAT_I = %h ", $time, SEL_O, DAT_I) ;
|
$fdisplay(log_file_desc, "*E (%0t)(%m)Byte select value: SEL_O = %b, Data bus value: DAT_I = %h ", $time, SEL_O, DAT_I) ;
|
end
|
end
|
end
|
end
|
end
|
end
|
end
|
end
|
|
|
initial
|
initial
|
begin
|
begin
|
previous_data = 0 ;
|
previous_data = 0 ;
|
previous_address = 0 ;
|
previous_address = 0 ;
|
can_change = 1 ;
|
can_change = 1 ;
|
end
|
end
|
endmodule // BUS_MON
|
endmodule // BUS_MON
|
|
|