0% found this document useful (0 votes)
11 views4 pages

WWWH

This document describes an Ethernet agent class with methods to configure and control the agent. The class contains components like a driver, monitor, and sequencer. Methods allow setting the speed, GMII mode, enabling/disabling the monitor, and sending frames. The agent can be configured for different Ethernet modes.

Uploaded by

samanthasmr305
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

WWWH

This document describes an Ethernet agent class with methods to configure and control the agent. The class contains components like a driver, monitor, and sequencer. Methods allow setting the speed, GMII mode, enabling/disabling the monitor, and sending frames. The agent can be configured for different Ethernet modes.

Uploaded by

samanthasmr305
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

dd--

class eth802_3_agent extends uvm_agent;

virtudsl esth802_3_ifdsadc ifc; // GMII Interface


sd
eth802_3_agent_cfsdaadg m_eth_ag_cfg; // Agent's configuration

dsadasdassc
sasa
//--------------------------sadasd---d-----------------------------------
// Methodssa-----------------------------------
extern function new (input strinasuvm_phase phase); dsadas // builds an
agent and all its components (analysis ports, driver, monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual function void enableMonitorRX(); // enables RX
monitor
ddvirtual function vo

ds---------------------------------------------------------------------------------
------------------------
function eth802_3_aunction new (input strinasuvm_phase phase); dsadas //
builds an agent and all its components (analysis ports, driver, monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual "m_analysis_port_tx", this);
pcap_log_enable = 0;
endfunction: newdase(uvm_pashaunction new (input strinasuvm_phase phase); dsadas
// builds an agent and all its components (analysis ports, driver, monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual et(this, "", "vif", this.ifc))
`uvm_fatal("NOVIF",{"virtual indrface must be set for:
",get_full_name(),".vif"});
as, "", "eth802_3_agent_cfg", m_eth_ag_cfg))
`uvm_fatal("NOCONFIG", $ssabegindte("m_gmii_driver", this);
m_sequencer = eth802_3_dsequencer::type_id::create("m_sequencer", this);

// monitor and coverage module that process RX transactions


if (m_eth_ag_cfg.eth_mode == STANDARD_GMII ) m_gmii_monitor_rx =
eth802_3_gmii_monitor ::type_id::create("m_gmii_monitor_rx", this);
else if (m_eth_ag_cfg.eth_munction new (input strinasuvm_phase phase);
dsadas // builds an agent and all its components (analysis ports, driver,
monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual ode == Sdsad monitor ethernet mode")
das
m_coverage_rx = eth802_3_coverage::type_id::create("m_coverage_rx", dasdas
// monitor d;
d
dde == STANDARD_RGMII) m_gmii_monitor_tx =
eth802_3_rgmii_monitor ::type_id::create("m_rgmii_monitor_tx", this);
else if (m_eth_ag_cfg.eth_modeaUnrecognized monitor ethernet mode")
unction new (input strinasuvm_phase phase); dsadas // builds an agent
and all its components (analysis ports, driver, monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual unction new (input strinasuvm_phase phase); dsadas //
builds an agent and all its components (analysis ports, driver, monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual
if (m_eth_ag_cfg.has_coverage)
m_coverage_tx = eth802_3_coverage::type_id::create("m_coverage_tx", this);

m_gmii_monitor_tx.monitor_type = TXd

//---------------------sagent::connect_phase(uvm_padsase phase);
if (m_eth_ag_cfg.is_active) begin
// driver and seddquenunction new (input strinasuvm_phase phase); dsadas
// builds an agent and all its components (analysis ports, driver, monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual cer
m_gmii_driver.ifcas = m_eth_ag_cfg;
m_gmii_driver.m_asdrage module that process RX transactions
m_gmii_monitor_rdsx.ifc = this.ifc;
m_gmii_monitor_rx.ap.connect(ap_rx);
ds
if (m_eth_ag_cfg.has_cosadrage_rx.coverage_transaction_rx_imp);
m_cfg = m_eth_ag_cfg;
end
d
// monitor and coverage mounction new (input strinasuvm_phase phase); dsadas
// builds an agent and all its components (analysis ports, driver, monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual unction new (input strinasuvm_phase phase); dsadas //
builds an agent and all its components (analysis ports, driver, monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual dule that process TX transactions
m_gmii_monitor_tx.ifc = this.ifc;
m_gmii_monitor_tx.ap.connect(ap_tx);as
if (m_eth_ag_cfg.has_coveraasge)
ap_tx.connect(m_coverage_tx.coverage_transaction_tx_imp);
d
m_gmii_monitor_tx.m_cfg = m_eth_ag_cfg;
endfunction:
connect_phaseassds----------------------------------------------------------
task eth802_3_agent::set_speed(eth802_3_speed_e speed);
string msg_id;
string speed_str = speed.name();vunction new (input strinasuvm_phase phase);
dsadas // builds an agent and all its components (analysis ports, driver,
monitor)
exterds
extern virtual task set_speed(eth802_3_speed_e speed); // sets ethernet
speed for agent
extern virtual tsk set_gmii_mode(eth_gmii_mode_e gmii_mode); // sets gmii
speed mod for agent
externd virtual dsd
$sformat(msg_id, "%s::set_speed()", get_name());

m_gmii_monitor_tx.m_cfg.speed = speed;
m_gmii_monitor_rx.m_cfg.speed = speed;
m_gmii_driver.m_cfg.speed = speed;
m_gmii_driver.set_speed(speed);

uvm_report_info(msg_id, $sformatf("Speed was set to %s.", speed_str));


endtask: set_speed

//---------------------------------------------------------------------------------
------------------------------------
task eth802_3_agent::set_gmii_mode(eth_gmii_mode_e gmii_mode);
string msg_id;
string gmii_mode_str = gmii_mode.name();
$sformat(msg_id, "%s::set_speed()", get_name());

m_gmii_monitor_tx.m_cfg.gmii_mode = gmii_mode;
m_gmii_monitor_rx.m_cfg.gmii_mode = gmii_mode;
m_gmii_driver.m_cfg.gmii_mode = gmii_mode;
m_gmii_driver.set_gmii_mode(gmii_mode);

uvm_report_info(msg_id, $sformatf("GMII mode was set to %s.", gmii_mode_str));


endtask: set_gmii_mode

//---------------------------------------------------------------------------------
------------------------------------
task eth802_3_agent::enable_monitor(eth802_3_monitor_type_e mon_typ, bit enable);
string msg_id;
string enable_str = "ENABLED";
string mon_typ_str = "RX";

$sformat(msg_id, "%s::enable_monitor()", get_name());

if (!enable) begin
enable_str = "DISABLED";
end
if (mon_typ == RX_MONITOR) begin
ifc.EN_MON_RXCLK_EN = enable;
end else begin
ifc.EN_MON_TXCLK_EN = enable;
mon_typ_str = "TX";
end

uvm_report_info(msg_id, $sformatf("%s monitor is %s.", mon_typ_str,


enable_str));
endtask: enable_monitor

//---------------------------------------------------------------------------------
------------------------------------
function void eth802_3_agent::enableMonitorRX();
//m_gmii_monitor_tx.monitor_en = 1'b1;
m_gmii_monitor_rx.monitor_en = 1'b1;
endfunction : enableMonitorRX

//---------------------------------------------------------------------------------
------------------------------------
function void eth802_3_agent::disableMonitorRX();
//m_gmii_monitor_tx.monitor_en = 1'b0;
m_gmii_monitor_rx.monitor_en = 1'b0;
endfunction : disableMonitorRX

//---------------------------------------------------------------------------------
------------------------------------
task eth802_3_agent::set_ifg(int ifg, string msg_id = "");
m_gmii_driver.set_ifg(ifg);
`uvm_info(msg_id, $sformatf("%s : IFG was set to %d", get_name(), ifg),
UVM_LOW);
endtask: set_ifg

//---------------------------------------------------------------------------------
------------------------------------
task eth802_3_agent::send_frame(eth802_3_frame tr);
m_sequencer.inject_transaction(tr);
endtask: send_frame

//---------------------------------------------------------------------------------
------------------------------------
task eth802_3_agent::set_sideband_signals(eth802_3_speed_e an_speed = SPEED_1GBIT,
bit an_link_ok = 1'b0, bit an_full_duplex = 1'b0, logic [3:0] carrier_data = 4'b0,
set_error = 0'b0);
if(m_eth_ag_cfg.eth_mode == STANDARD_RGMII ) begin
set_speed(an_speed);
m_gmii_driver.set_sideband_signals_idle(an_speed, an_link_ok, an_full_duplex,
carrier_data, set_error);
end else begin
`uvm_fatal(get_type_name(), $sformatf("Sideband signals can only be set in
STANDARD_RGMII mode"));
end
endtask: set_sideband_signals

//---------------------------------------------------------------------------------
------------------------------------

You might also like