Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Few updates to WB VIP #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
7 changes: 7 additions & 0 deletions src/wishbone_b3/wishbone_b3_if.sv
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//////////////////////////////////////////////////////////////////////////////
// Modifications:
// 2016-08-11: by Jan Pospisil ([email protected])
// * added timeunit/timeprecision to WB interface
//////////////////////////////////////////////////////////////////////////////

`ifndef WISHBONE_B3_IF__SV
`define WISHBONE_B3_IF__SV
Expand Down Expand Up @@ -65,6 +69,9 @@ interface wishbone_b3_if #(DAT_W = 64, ADR_W = 32, TAG_W = 1) (input bit clk)
//parameter ADR_W = 32; // address port width
//parameter TAG_W = 1; // default tag widths are 1 bit

timeunit 1ns;
timeprecision 1ps;

localparam SEL_W = (DAT_W/8); // 1 select bit per data byte, divide by 8

/// common signals ///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//////////////////////////////////////////////////////////////////////////////
// Modifications:
// 2016-06-08: by Jan Pospisil ([email protected])
// * removed constructs which seems not to be supported in UVM 1.2
// * fixed reset logic (WB_B3 Rule 2.30)
// * do not issue a transaction when reset is active
// 2016-06-13: by Jan Pospisil ([email protected])
// * fixed beginning of transaction for closely successive operations
//////////////////////////////////////////////////////////////////////////////

`ifndef WISHBONE_B3_DRIVER__SV
`define WISHBONE_B3_DRIVER__SV
Expand Down Expand Up @@ -46,13 +54,9 @@ endfunction: new
function void wishbone_b3_master_driver::build_phase(uvm_phase phase);
super.build_phase(phase);

phase.raise_objection(this);

common_mthds = wishbone_b3_common_methods #(.DAT_W(DAT_W), .ADR_W(ADR_W), .TAG_W(TAG_W))::type_id::create("common_mthds", this);
common_mthds.sigs = sigs;

phase.drop_objection(this);

endfunction: build_phase

//------------------------------------------------------------------------//
Expand Down Expand Up @@ -87,8 +91,13 @@ endtask: run_phase

//------------------------------------------------------------------------//
task wishbone_b3_master_driver::write_transaction(td_wishbone_b3_sequence_item s_item);
// wait for inactive reset
wait(sigs.rst_i === 1'b0);

//stating a cycle
// wait for free bus
wait(~sigs.m_drv_cb.ack & ~sigs.m_drv_cb.err & ~sigs.m_drv_cb.rty);

// stating a cycle
sigs.m_drv_cb.cyc <= 1'b1;
sigs.m_drv_cb.tgc <= '0; // cycle tag currently not supported

Expand All @@ -113,6 +122,12 @@ endtask: write_transaction

//------------------------------------------------------------------------//
task wishbone_b3_master_driver::read_transaction(td_wishbone_b3_sequence_item s_item);
// wait for inactive reset
wait(sigs.rst_i === 1'b0);

// wait for free bus
wait(~sigs.m_drv_cb.ack & ~sigs.m_drv_cb.err & ~sigs.m_drv_cb.rty);

//stating a cycle
sigs.m_drv_cb.cyc <= 1'b1;
sigs.m_drv_cb.tgc <= '0; // cycle tag currently not supported
Expand Down Expand Up @@ -142,7 +157,7 @@ endtask: read_transaction
// This isn't being sent through a clocking block since the
// reset is asynchronous and there is no guarantee the clock is toggling
task wishbone_b3_master_driver::drive_x_to_outputs_during_reset();
wait(sigs.rst_i === 1'b0);
wait(sigs.rst_i === 1'b1);
sigs.dat_o = 'x;
sigs.tgd_o = 'x;
sigs.adr = 'x;
Expand All @@ -154,7 +169,7 @@ task wishbone_b3_master_driver::drive_x_to_outputs_during_reset();
sigs.tgc = 'x;
sigs.we = 'x;

wait(sigs.rst_i === 1'b1);
wait(sigs.rst_i === 1'b0);
sigs.dat_o = '0;
sigs.tgd_o = '0;
sigs.adr = '0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//////////////////////////////////////////////////////////////////////////////
// Modifications:
// 2016-06-08: by Jan Pospisil ([email protected])
// * removed constructs which seems not to be supported in UVM 1.2
//////////////////////////////////////////////////////////////////////////////

`ifndef WISHBONE_B3_MONITOR__SV
`define WISHBONE_B3_MONITOR__SV
Expand Down Expand Up @@ -49,14 +53,10 @@ endfunction: new
function void wishbone_b3_monitor::build_phase(uvm_phase phase);
super.build_phase(phase);

phase.raise_objection(this);

this.analysis_port = new("analysis_port", this);
common_mthds = wishbone_b3_common_methods #(.DAT_W(DAT_W), .ADR_W(ADR_W), .TAG_W(TAG_W))::type_id::create("common_mthds", this);
common_mthds.sigs = sigs;

phase.drop_objection(this);

endfunction: build_phase

//------------------------------------------------------------------------//
Expand Down
19 changes: 12 additions & 7 deletions src/wishbone_b3/wishbone_b3_package.sv
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//////////////////////////////////////////////////////////////////////////////
// Modifications:
// 2016-06-08: by Jan Pospisil ([email protected])
// * file extensions renamed (.sv for compilable units, .svh for
// include-able units)
//////////////////////////////////////////////////////////////////////////////

`ifndef WISHBONE_B3_PACKAGE__SV
`define WISHBONE_B3_PACKAGE__SV
Expand Down Expand Up @@ -52,13 +57,13 @@ package wishbone_b3_package;
WB_B3_RESPONSE_ACK_RTY = 2
} e_wishbone_b3_response;

`include "wishbone_b3_common_methods.sv"
`include "wishbone_b3_master_cfg.sv"
`include "wishbone_b3_sequence_item.sv"
`include "wishbone_b3_master_driver.sv"
`include "wishbone_b3_monitor.sv"
`include "wishbone_b3_reg_adapter.sv"
`include "wishbone_b3_master_agent.sv"
`include "wishbone_b3_common_methods.svh"
`include "wishbone_b3_master_cfg.svh"
`include "wishbone_b3_sequence_item.svh"
`include "wishbone_b3_master_driver.svh"
`include "wishbone_b3_monitor.svh"
`include "wishbone_b3_reg_adapter.svh"
`include "wishbone_b3_master_agent.svh"

endpackage: wishbone_b3_package

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//////////////////////////////////////////////////////////////////////////////
// Modifications:
// 2016-06-14: by Jan Pospisil ([email protected])
// * added get_type_name() and convert2string() methods; now this
// call is possible:
// $sformatf(
// "Transaction \"%s\" received: %s",
// t.get_type_name(), t.convert2string())
//////////////////////////////////////////////////////////////////////////////

`ifndef WISHBONE_B3_SEQUENCE_ITEM__SV
`define WISHBONE_B3_SEQUENCE_ITEM__SV
Expand Down Expand Up @@ -53,7 +61,9 @@ class wishbone_b3_sequence_item #(ADR_W = 32, DAT_W = 64, TAG_W = 1) extends uvm
`uvm_field_enum( e_wishbone_b3_response, response_e, UVM_ALL_ON)
`uvm_object_utils_end

extern function new(string name = "wishbone_b3_sequence_item");
extern function new(string name = "wishbone_b3_sequence_item");
extern function string get_type_name();
extern function string convert2string();

extern constraint response_c;
extern constraint select_c;
Expand All @@ -68,6 +78,25 @@ function wishbone_b3_sequence_item::new(string name = "wishbone_b3_sequence_item

endfunction: new

//------------------------------------------------------------------------//
// function: get_type_name
// override of super's method for parametrized class
function string wishbone_b3_sequence_item::get_type_name();
return "wishbone_b3_sequence_item";

endfunction

//------------------------------------------------------------------------//
// function: convert2string
// for custom displaying class content
function string wishbone_b3_sequence_item::convert2string();
// convert2string = "TBD";
convert2string = $sformatf(
"direction_e = %s, address = 0x%H, data = 0x%H, select = 0b%B, response_e = %s",
direction_e.name(), address, data, select, response_e.name());

endfunction

//------------------------------------------------------------------------//
// constraint: response_c
// constraints variable <response_e>. Default value = WB_B3_RESPONSE_ACK_ERR.
Expand Down