This section examines the e code for the various components of the XSerial eVC. Note that we have skipped over the details of the XSerial Bus Protocol because this chapter focuses on the organization of the XSerial eVC. Note that e code for the high-level components is shown in this section. Some files are omitted in this book. Although all low-level details of the XSerial eVC may not be included in the e code, the purpose of this section is to give you an idea of structure of a typical eVC.
Example 15-1 describes the e code of data item for XSerial eVC.
/*--------------------------------------------------------------------- File name : vr_xserial_frame_payload_h.e Title : XSerial eVC frame payload structure Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 16-Apr-2002 Description : his file declares the format of the generic XSerial frame : payload. Notes : ----------------------------------------------------------------------- Copyright 2002 (c) Verisity Design ---------------------------------------------------------------------*/ <' package vr_xserial; -- This type is used to enumerate the 2-bit frame_format field in the -- frame. The various possible sub-types are extended in the files that -- declare the sub-type formats. Note that the UNDEFINED value is used -- in the case where the user wants to generate a payload with an -- illegal frame_format value. type vr_xserial_frame_format_t : [UNDEFINED = UNDEF]; -- This type is used to specify the status of a frame. type vr_xserial_frame_status_t : [BAD_FORMAT]; -- illegal format field -- value -- This struct contains the payload for a frame. struct vr_xserial_frame_payload_s { -- This field indicates the status of the payload. status : list of vr_xserial_frame_status_t; keep soft status.size() == 0; -- This field holds the destination address for the frame. %destination : uint(bits:2); -- This field specifies the format of frame. frame_format : vr_xserial_frame_format_t; keep BAD_FORMAT in status => frame_format == UNDEFINED; -- This field is the actual physical frame format field as encoded -- in the frame. %physical_frame_format : uint(bits:2); keep frame_format != UNDEFINED => physical_frame_format == frame_format.as_a(uint); keep frame_format == UNDEFINED => physical_frame_format not in all_values(vr_xserial_frame_format_t).all(it != UNDEFINED).apply(it.as_a(uint)); -- This method returns the payload as a list of bits. By using this -- method rather than explicitly packing the struct, the user does -- not need to be aware of the details of how a payload is packed. -- Note that in the XSerial eVC example, this is trivial, but in -- more complex eVCs, the process of packing a struct may be -- complex. pack_payload() : list of bit is { result = pack(packing.low, me); }; -- pack_payload() -- This method takes a bitstream and unpacks it into the payload -- struct. As with pack_payload(), this method hides the -- implementation details -- of the struct packing/unpacking from the user. unpack_payload(bitstream : list of bit, check_protocol : bool) is { -- Assume that this payload is going to be legal until we -- discover otherwise. status = {}; -- The payload should always be exactly 12 bits long. if bitstream.size() != 12 { error("FATAL: Frame payload is not 12 bits long"); }; -- Unpack the destination and frame_format fields. unpack(packing.low, bitstream, destination, physical_frame_format); if physical_frame_format in all_values(vr_xserial_frame_format_t).apply(it.as_a(uint)) { frame_format = physical_frame_format.as_a(vr_xserial_frame_format_t); } else { frame_format = UNDEFINED; }; -- Make the bitstream parameter point to the rest of the -- bitstream -- so that sub-typed extensions to this method can unpack the -- rest of the payload. bitstream = bitstream[4..]; -- Make sure we've got a legal frame format. if check_protocol { check that frame_format != UNDEFINED else dut_error("Illegal frame format found: ", physical_frame_format); }; -- If the frame format is illegal, then set the status field -- accordingly. if frame_format == UNDEFINED { status.add(BAD_FORMAT); }; }; -- unpack_payload() -- This method returns a convenient string representation of the -- contents of the payload. This is used for logging, -- waveform viewing, etc. nice_string(): string is { result = appendf("DEST:%01d", destination); }; -- nice_string() -- This method compares this payload with a payload supplied as a -- parameter. If the compare_dest field is false, then differences -- in the destination fields are ignored. It returns a list of -- strings that contains all detected differences. compare_payloads(exp_payload : vr_xserial_frame_payload_s, compare_dest : bool) : list of string is { if compare_dest and exp_payload.destination != destination { result.add(append("Expected destination field: ", bin(exp_payload.destination), ", Actual destination field: ", bin(destination))); }; if exp_payload.frame_format != frame_format { result.add(append("Expected format field: ", exp_payload.frame_format, ", Actual format field: ", frame_format)); return result; }; }; -- compare_payloads() }; -- struct vr_xserial_frame_payload_s -- If we have an illegal frame_format field, then none of the sub-typed -- extensions will come into play so the remaining 8 bits of the -- payload won't be there. We need the payload to always be 12 bits -- long, so extend payloads with illegal frame formats to provide a -- dummy 8-bit field. extend UNDEFINED vr_xserial_frame_payload_s { -- This field pads out the remaining 8 bits if the frame format is -- illegal. %dummy : byte; -- Unpack the remaining bits into the dummy field unpack_payload(bitstream : list of bit, check_protocol : bool) is also { unpack(packing.low, bitstream, dummy); }; -- unpack_payload() -- Make sure that if this payload gets printed, the bad frame format -- is included in the string. nice_string(): string is also { result = appendf("%s BAD_FORMAT:%02b ", result, physical_frame_format.as_a(uint(bits:2))); }; -- nice_string() }; -- extend UNDEFINED vr_xserial_frame_payload_s '>
Example 15-2 describes the e code of the agent for XSerial eVC.
/*------------------------------------------------------------------------- File name : vr_xserial_agent_h.e Title : Agent unit public interface Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 03-Jan-2002 Description : This file declares the public interface of the agent unit. Notes : Because the agent handles both the TX and RX parts of a link, : the 'has_tx_path' and 'has_rx_path' fields are used to : sub-type the agent so that the TX and RX paths can be : separately disabled. These fields are controlled by the user : accesible field 'directions' --------------------------------------------------------------------------- Copyright 2002 (c) Verisity Design -------------------------------------------------------------------------*/ <' package vr_xserial; -- This type enumerates the possible modes of operation of an agent regarding -- data directions. type vr_xserial_directions_t : [TX_AND_RX, TX_ONLY, RX_ONLY]; -- This unit represents the eVCs main agent. An agent handles one -- bidirectional XSerial link. unit vr_xserial_agent_u { -- This field holds the logical name of the eVC instance this agent is -- contained in name : vr_xserial_env_name_t; -- This field holds the signal name of the TX_CLOCK signal on the XSERIAL -- interface. sig_tx_clock : string; -- This field holds the signal name of the TX_DATA signal on the XSERIAL -- interface. sig_tx_data : string; -- This field holds the signal name of the RX_CLOCK signal on the XSERIAL -- interface. sig_rx_clock : string; -- This field holds the signal name of the RX_DATA signal on the XSERIAL -- interface. sig_rx_data : string; -- This field holds the signal name of the RESET signal on the XSERIAL -- interface. If there is no reset signal in the design, then this -- field should be left unconstrained. sig_reset : string; keep soft sig_reset == ""; -- This field controls the active level of the RESET signal. By default, -- the reset is active high, but by constraining this field to 0, it -- can be set to active low. reset_active_level : bit; keep soft reset_active_level == 1; -- This field determines what reset state the eVC starts in at the -- beginning of a test. By default, the eVC assumes that reset is -- asserted at the start of a test. Where the sig_reset field is -- constrained, the reset_asserted field will then go to FALSE at the -- first de-assertion of the reset signal. Where the sig_reset field -- is not constrained, the eVC can then be brought out of the reset state -- by emitting the reset_end event. reset_asserted : bool; keep soft reset_asserted == TRUE; -- This field specifies whether this agent is ACTIVE or PASSIVE. In ACTIVE -- mode, the agent drives signals and models one end of an XSerial link. -- In PASSIVE mode the agent never drives signals and just monitors both -- directions of an XSerial link. active_passive : erm_active_passive_t; keep soft active_passive == ACTIVE; -- This field allows the user to disable either the TX path or the RX -- path. This can be used in cases where testing is only required of -- one direction. When this field is TX_ONLY, flow control cannot work -- and is disabled (i.e. the eVC will always consider the TX link as -- ready). directions : vr_xserial_directions_t; keep soft directions == TX_AND_RX; -- If this field is TRUE then the agent does protocol checking on the -- tx_data signal. check_tx_protocol : bool; keep soft check_tx_protocol == TRUE; -- If this field is TRUE then the agent does protocol checking on the -- rx_data signal. check_rx_protocol : bool; keep soft check_rx_protocol == TRUE; -- This field controls the period of the TX clock in simulator time units. -- If this field is 0, then the eVC does not generate the clock. Note that -- this field is only used if the agent is ACTIVE and has a tx path. It -- is recommended that this field be constrained using physical time units -- e.g.: keep tx_clock_period == 20 ns; This ensures that there is no -- dependency on the simulator time resolution. tx_clock_period : time; keep soft tx_clock_period == 0; -- If this field is not "" then the agent writes a log file of that -- name with a .elog extension. This log file contains all TX -- transactions. If both this field and rx_log_filename are the -- same then both TX and RX log information will be written to a -- single file. tx_log_filename : string; keep soft tx_log_filename == "vr_xserial"; -- If this field is not "" then the agent writes a log file of that -- name with a .elog extension. This log file contains all RX -- transactions. If both this field and tx_log_filename are the -- same then both TX and RX log information will be written to a -- single file. rx_log_filename : string; keep soft rx_log_filename == "vr_xserial"; -- The user can extend this method to hook in a scoreboard. The user MUST NOT -- alter the frame in any way. tx_frame_completed(frame : vr_xserial_frame_s) is empty; -- The user can extend this method to hook in a scoreboard. The user MUST NOT -- alter the frame in any way. rx_frame_completed(frame : vr_xserial_frame_s) is empty; -- This field is set to the frame just transmitted just before the -- tx_frame_done event is emitted. !tx_frame : MONITOR vr_xserial_frame_s; -- This field is set to the frame just received just before the -- rx_frame_done event is emitted. !rx_frame : MONITOR vr_xserial_frame_s; -- This event gets emitted each time a frame is transmitted. In -- conjunction with the tx_frame field, it can be used as an -- alternative scoreboard hook to tx_frame_completed(). event tx_frame_done; -- This event gets emitted each time a frame is transmitted. In -- conjunction with the rx_frame field, it can be used as an -- alternative scoreboard hook to rx_frame_completed(). event rx_frame_done; -- This event gets emitted when reset is asserted. If there is no reset -- signal, then the user can emit this event directly to initiate reset -- for this instance of the eVC. event reset_start; -- This event gets emitted when reset is de-asserted. If there is no -- reset signal, then the user can emit this event directly to terminate -- reset for this instance of the eVC. event reset_end; -- This field is used to sub-type the agent for when the TX path is -- enabled. has_tx_path : bool; keep has_tx_path == value(directions in [TX_ONLY, TX_AND_RX]); -- This field is used to sub-type the agent for when the RX path is -- enabled. has_rx_path : bool; keep has_rx_path == value(directions in [RX_ONLY, TX_AND_RX]); }; -- unit vr_xserial_agent_u extend vr_xserial_monitor_u { -- This field is a back-pointer to the agent that contains the monitor. agent : vr_xserial_agent_u; }; -- extend vr_xserial_monitor_u extend vr_xserial_tx_bfm_u { -- This field is a back-pointer to the agent that contains the BFM. agent : vr_xserial_agent_u; }; -- extend vr_xserial_tx_bfm_u extend has_tx_path vr_xserial_agent_u { -- This field is the instance of the monitor for the transmit direction. -- It only exists if the TX direction is enabled for this agent. tx_monitor : TX vr_xserial_monitor_u is instance; keep tx_monitor.file_logger.to_file == value(tx_log_filename); keep tx_monitor.sig_clock == value(sig_tx_clock); keep tx_monitor.sig_data == value(sig_tx_data); keep tx_monitor.agent == me; keep tx_monitor.has_protocol_checker == value(check_tx_protocol); }; -- extend has_tx_path vr_xserial_agent_u extend has_rx_path vr_xserial_agent_u { -- This field is the instance of the monitor for the receive direction. -- It only exists if the RX direction is enabled for this agent. rx_monitor : RX vr_xserial_monitor_u is instance; keep rx_monitor.file_logger.to_file == value(rx_log_filename); keep rx_monitor.sig_clock == value(sig_rx_clock); keep rx_monitor.sig_data == value(sig_rx_data); keep rx_monitor.agent == me; keep rx_monitor.has_protocol_checker == value(check_rx_protocol); }; -- extend has_rx_path vr_xserial_agent_u -- If in ACTIVE mode with TX path enabled, then add a TX BFM and a TX sequence -- driver. extend ACTIVE has_tx_path vr_xserial_agent_u { -- This field is the instance of the transmit BFM. It only exists if the -- TX direction is enabled for this agent and the agent is ACTIVE. tx_bfm : vr_xserial_tx_bfm_u is instance; keep tx_bfm.agent == me; keep tx_bfm.driver == value(tx_driver); keep tx_bfm.tx_monitor == value(tx_monitor); keep tx_bfm.sig_tx_clock == value(sig_tx_clock); keep tx_bfm.sig_tx_data == value(sig_tx_data); -- This field is the instance of the transmit sequence driver. It only -- exists if the TX direction is enabled for this agent and the agent is -- ACTIVE. tx_driver : vr_xserial_tx_driver_u is instance; keep tx_driver.name == value(name); }; -- extend ACTIVE has_tx_path vr_xserial_agent_u -- If both monitors are present, make them aware of each other. extend has_rx_path has_tx_path vr_xserial_agent_u { -- Note that these pointers need to be set up in post_generate to avoid -- a generation order cycle. post_generate() is also { tx_monitor.reverse_monitor = rx_monitor; rx_monitor.reverse_monitor = tx_monitor; }; -- post_generate() }; -- extend has_rx_path has_tx_path vr_xserial_agent_u -- If agent is in ACTIVE mode and both paths are enabled, then the Tx BFM needs -- to know where the Rx monitor is so it can check on the current state of -- flow control extend ACTIVE has_rx_path has_tx_path vr_xserial_agent_u { keep tx_bfm.rx_monitor == value(rx_monitor); }; -- extend ACTIVE has_rx_path has_tx_path vr_xserial_agent_u '>
Example 15-3 describes the e code for Tx BFM of XSerial eVC.
/*------------------------------------------------------------------------- File name : vr_xserial_bfm_tx_h.e Title : TX BFM public interface Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 23-Jul-2002 Description : This file declares the public interface of the TX BFM unit. Notes : There is no RX BFM because the RX link direction contains no : signals that the eVC can drive. As such, the entire RX path : functionality is contained in the RX monitor and the eVC does : not need either an RX BFM or an RX sequence driver. : : The BFM depends on the functionality of the RX and TX : monitors. --------------------------------------------------------------------------- Copyright 2002 (c) Verisity Design -------------------------------------------------------------------------*/ <' package vr_xserial; -- This unit is the BFM used for the transmit direction (i.e. sending data -- from the eVC to the DUT). unit vr_xserial_tx_bfm_u { -- This field is a pointer to the TX monitor. tx_monitor : vr_xserial_monitor_u; -- This field is a pointer to the RX monitor (or NULL if the RX path is -- disabled). rx_monitor : vr_xserial_monitor_u; keep soft rx_monitor == NULL; -- This field is a pointer to the sequence driver. driver : vr_xserial_tx_driver_u; -- This field holds the signal name of the TX_CLOCK signal on the XSERIAL -- interface. sig_tx_clock : string; -- This field holds the signal name of the TX_DATA signal on the XSERIAL -- interface. sig_tx_data : string; }; -- unit vr_xserial_tx_bfm_u '>
Example 15-4 describes the e code of the agent Tx sequence for XSerial eVC.
/*------------------------------------------------------------------------- File name : vr_xserial_sequence_tx_h.e Title : Sequence stuff for TX side Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 07-Nov-2001 Description : This file implements TX sequences. Notes : --------------------------------------------------------------------------- Copyright 2002 (c) Verisity Design -------------------------------------------------------------------------*/ <' package vr_xserial; -- This type enumerates the logical names of each instance of the eVC in the -- Verification Environment. type vr_xserial_env_name_t : []; -- This creates a sub-type of the frame struct that has additional -- information relating to generation of frames by the sequence -- interface. extend TX vr_xserial_frame_s { -- This field can be used to sub-type the TX frame according to the -- eVC instance that is sending it. name : vr_xserial_env_name_t; keep name == value(driver.name); -- This field controls the delay before transmission of this frame in -- clock cycles - timed from the end of the previous frame. transmit_delay : uint; keep soft transmit_delay in [5..20]; }; -- extend TX vr_xserial_frame_s -- This is the generic sequence struct for transmitting frames from the eVC. sequence vr_xserial_tx_sequence using item=TX vr_xserial_frame_s, created_driver=vr_xserial_tx_driver_u; -- Provide extensions to the sequence driver so that the driver, the sequence -- and the sequence items can all be sub-typed by the instance name of the -- eVC. extend vr_xserial_tx_driver_u { -- This field holds the name of the env this driver is contained in. name : vr_xserial_env_name_t; -- propagate master name to sequence tree keep sequence.name == value(name); }; -- extend vr_xserial_tx_driver_u extend vr_xserial_tx_sequence { -- This field allows sequences to be sub-typed on the name of the env. name : vr_xserial_env_name_t; keep name == value(driver.name); -- This is a utility field for basic sequences. This allows the user to -- do "do frame ...". !frame: TX vr_xserial_frame_s; }; -- extend vr_xserial_tx_sequence '>
Example 15-5 describes the e code of the monitor for XSerial eVC.
/*------------------------------------------------------------------------- File name : vr_xserial_monitor_h.e Title : XSerial monitor unit public interface Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 23-Jul-2002 Description : The monitor unit implements a monitor for one direction of : traffic on an XSerial interface. This file defines the public : interface of the monitor unit. One instance of the monitor : unit is placed in the agent for each data direction. The : monitor is largely self-contained and standalone. It creates : instances of the MONITOR sub-type of the frame (which : contains additional information to the GENERIC sub-type) and : optionally writes information to a log file. Notes : --------------------------------------------------------------------------- Copyright 2002 (c) Verisity Design -------------------------------------------------------------------------*/ <' package vr_xserial; -- This type is used by the monitor to indicate which direction of data -- transfer the monitor is monitoring. type vr_xserial_direction_t : [TX, RX]; -- Provide a message tag that can be used to direct certain message -- actions to a log file. extend message_tag: [VR_XSERIAL_FILE]; -- Provide a MONITOR frame sub-type with some extra fields and methods to -- assist in monitoring. extend MONITOR vr_xserial_frame_s{ -- This field indicates which eVC instance this frame is associated with. name : vr_xserial_env_name_t; -- This field holds the time between the end of the previous frame and -- the beginning of this one. delay : uint; }; -- extend MONITOR vr_xserial_frame_s -- This unit contains a monitor that is capable of monitoring traffic in -- one direction on an XSerial link. Two instances of this unit are required -- to monitor a bidirectional link. unit vr_xserial_monitor_u { -- This field indicates whether the monitor is monitoring the TX or RX -- direction. direction : vr_xserial_direction_t; -- This is the logger used for creating log files. file_logger: message_logger; keep file_logger.tags == {VR_XSERIAL_FILE}; keep soft file_logger.to_screen == FALSE; keep soft file_logger.format == none; keep soft file_logger.verbosity == FULL; -- This is the clock signal of the link being monitored. sig_clock : string; -- This is the data signal of the link being monitored. sig_data : string; -- If this field is TRUE then the agent does protocol checking has_protocol_checker : bool; -- This event is the clock rise event for this direction prior to -- qualification with reset. event unqualified_clock_rise is rise('(sig_clock)') @sim; -- This event is the clock fall event for this direction prior to -- qualification with reset. event unqualified_clock_fall is rise('(sig_clock)') @sim; -- This is the main clock rise event for this direction. Note that this -- clock is qualified with reset and so is only emitted when reset is -- not asserted. event clock_rise; -- This is the main clock fall event for this direction. Note that this -- clock is qualified with reset and so is only emitted when reset is -- not asserted. event clock_fall; -- This field is a pointer to the monitor for the reverse link direction. -- If such a monitor does not exist (perhaps one link direction has been -- disabled), then this field will be NULL. reverse_monitor : vr_xserial_monitor_u; keep soft reverse_monitor == NULL; -- This field indicates whether the device sending the frames that this -- monitor is monitoring is currently ready to receive frames or not. !ready : bool; -- The monitored frame is built up in this field. !monitor_frame : MONITOR vr_xserial_frame_s; -- This field counts the number of frames this monitor detects over the -- duration of the test. num_frames : uint; keep num_frames == 0; -- This event is emitted at the start of a frame. event frame_started; -- This event is emitted at the end of a frame. event frame_ended; -- This TCM starts the monitor. It gets called by the agent to start the -- monitor at the start of the test and each time reset is asserted. The -- user can delay activation of the monitor by extending this method using -- 'is first'. start_tcms() @sys.any is undefined; }; -- unit vr_xserial_monitor_u '>
Example 15-6 describes the e code of the checker for XSerial eVC.
/*------------------------------------------------------------------------- File name : vr_xserial_protocol_checker.e Title : Protocol checker Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 03-Jan-2002 Description : This file contains the optional protocol checker : functionality within the monitor. Notes : --------------------------------------------------------------------------- Copyright 2002 (c) Verisity Design -------------------------------------------------------------------------*/ <' package vr_xserial; extend has_protocol_checker vr_xserial_monitor_u { -- This event is emitted in each clock cycle where the remote device -- has signalled that it is not ready to receive data frames. The falling -- edge of clock is used to ensure that there are no race conditions in -- the case where both monitors are clocked off the same clock signal. If -- the rising edge is used then the order in which the RX and TX monitors -- react to the rising edge of clock can affect the protocol checker. event halted is true((reverse_monitor != NULL) and (not reverse_monitor.ready)) @clock_fall; -- This event is the same as halted but delayed to the next rising edge of -- clock. event halted_del is {@halted; [1]} @clock_rise; -- This event is emitted each time a frame starts while the remote device -- is not ready. Note that halted_del is used to allow for the -- possibility that the frame started at the same clock edge as a HALT -- frame was received (which is allowed). event frame_start_halted is (@halted_del and @frame_started) @clock_rise; -- This event is emitted each time a message frame ends event message_frame_ended is true(monitor_frame.payload is a MESSAGE vr_xserial_frame_payload_s) @frame_ended; -- At the end of each frame, check that either it was a message frame or -- the remote device hadn't signalled a HALT before the start of the -- frame. Only message frames are allowed to start while the remote -- device is not ready. expect exp_send_while_not_ready is (not @frame_start_halted) or @message_frame_ended @frame_ended else dut_error("Non-message frame sent while remote device was not ready"); }; -- extend has_protocol_checker vr_xserial_monitor_u -- Whenever a DUT error occurs in the monitor, print some useful information -- about which monitor it occurred in. extend dut_error_struct { write() is first { -- Ascertain which unit originated the error var caller_unit : any_unit = source_struct().get_unit(); -- depending on what sort of unit originated the error, amend the error message if caller_unit is a vr_xserial_monitor_u (monitor) { message = append(monitor.agent.err_header(), ", ", monitor.err_header(), ":\n", message); }; }; -- write() }; -- extend dut_error_struct '>
Example 15-7 describes the e code for coverage of XSerial eVC.
/*------------------------------------------------------------------------- File name : vr_xserial_coverage_h.e Title : Coverage definitions Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 08-Jan-2002 Description : This file provides a basic functional coverage model for : frames. The user can extend this to create additional : coverage as required. Notes : Two different coverage events are used here because, at : present, Specman Elite only supports one-dimensional per-instance : coverage. In this case, we have two dimensions: the agent : name and the direction. By using two events, one for each : direction, separate coverage groups can be maintained for : each direction. --------------------------------------------------------------------------- Copyright 2002 (c) Verisity Design -------------------------------------------------------------------------*/ <' package vr_xserial; extend vr_xserial_frame_s { -- This event is emitted by the appropriate TX monitor whenever a frame -- transmission completes. It is used to collect coverage. event tx_frame_done; -- This event is emitted by the appropriate RX monitor whenever a frame -- reception completes. It is used to collect coverage. event rx_frame_done; }; -- extend vr_xserial_frame_s extend vr_xserial_monitor_u { -- Each time a frame ends, emit the event used to collect coverage for -- that frame. on frame_ended { case direction { TX : { emit monitor_frame.tx_frame_done; }; RX : { emit monitor_frame.rx_frame_done; }; }; }; }; -- extend vr_xserial_monitor_u extend MONITOR vr_xserial_frame_s { cover tx_frame_done is { item name using per_instance; item destination : uint(bits:2) = payload.destination; item frame_format : vr_xserial_frame_format_t = payload.frame_format; item data : byte = payload.as_a(DATA vr_xserial_frame_payload_s).data using when = (payload is a DATA vr_xserial_frame_payload_s); item message : vr_xserial_frame_message_t = payload.as_a(MESSAGE vr_xserial_frame_payload_s).message using when = (payload is a MESSAGE vr_xserial_frame_payload_s); item parity; item delay; }; -- cover tx_frame_done cover rx_frame_done is { item name using per_instance; item destination : uint(bits:2) = payload.destination; item frame_format : vr_xserial_frame_format_t = payload.frame_format; item data : byte = payload.as_a(DATA vr_xserial_frame_payload_s).data using when = (payload is a DATA vr_xserial_frame_payload_s); item message : vr_xserial_frame_message_t = payload.as_a(MESSAGE vr_xserial_frame_payload_s).message using when = (payload is a MESSAGE vr_xserial_frame_payload_s); item parity; item delay; }; -- cover rx_frame_done }; -- extend vr_xserial_frame_s '>
Example 15-8 describes the e code for the environment of XSerial eVC.
/*------------------------------------------------------------------------- File name : vr_xserial_env_h.e Title : Env unit public interface Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 03-Jan-2002 Description : This file contains the declaration of the env unit and all : user accessible fields, events and methods. Notes : In this eVC, there is only a single agent per env. An env : should contain all agents that logically belong to the same : "network". In the case of the XSerial protocol, a network : consists only of two devices linked bidirectionally. Because : all the behaviour of one device can be deduced by looking at : the signals at the other device, there is no need to have a : passive agent monitoring the other end of the link. As such, : only a single agent is ever required per env. --------------------------------------------------------------------------- Copyright 2002 (c) Verisity Design -------------------------------------------------------------------------*/ <' package vr_xserial; -- This unit is the env - the top level unit of the eVC. unit vr_xserial_env_u like any_env { -- This field provides a screen logger for the env. Note that this eVC -- has only a single agent per env, so there is no point adding a separate -- screen logger for each agent. logger: message_logger; keep soft logger.verbosity == NONE; -- This field holds the logical name of this eVC instance. name : vr_xserial_env_name_t; -- The short_name() method should return the name of this eVC instance. short_name(): string is { result = append(name); }; -- This controls what colour the short name is shown in. short_name_style(): vt_style is { result = DARK_CYAN; }; -- This field is the instance of the agent. Note that each env (eVC -- instance) has just one agent that handles both Tx and Rx directions. agent : vr_xserial_agent_u is instance; keep agent.name == value(name); }; -- unit vr_xserial_env_u '>
Example 15-9 describes the e code for top file of XSerial eVC.
/*------------------------------------------------------------------------- File name : vr_xserial_top.e Title : Top level of XSerial eVC Project : XSerial eVC Developers : Richard Vialls, Black Cat Electronics Ltd Created : 07-Nov-2001 Description : This file imports all files in the eVC Notes : Files ending in _h.e are public files for the user to read : all other files could potentially be encrypted. --------------------------------------------------------------------------- Copyright 2002 (c) Verisity Design -------------------------------------------------------------------------*/ <' package vr_xserial; define VR_XSERIAL_VERSION_1_0_OR_LATER; define VR_XSERIAL_VERSION_1_1_OR_LATER; define VR_XSERIAL_VERSION_1_2_OR_LATER; define VR_XSERIAL_VERSION_1_3_OR_LATER; define VR_XSERIAL_VERSION_1_4_OR_LATER; define VR_XSERIAL_VERSION_1_4; import evc_util/e/evc_util_top; import vr_xserial/e/vr_xserial_frame_payload_h; import vr_xserial/e/vr_xserial_frame_h; import vr_xserial/e/vr_xserial_frame_payload_data_h; import vr_xserial/e/vr_xserial_frame_payload_message_h; import vr_xserial/e/vr_xserial_sequence_tx_h; import vr_xserial/e/vr_xserial_monitor_h; import vr_xserial/e/vr_xserial_bfm_tx_h; import vr_xserial/e/vr_xserial_agent_h; import vr_xserial/e/vr_xserial_env_h; import vr_xserial/e/vr_xserial_coverage_h; import vr_xserial/e/vr_xserial_bfm_tx; import vr_xserial/e/vr_xserial_monitor; import vr_xserial/e/vr_xserial_agent; import vr_xserial/e/vr_xserial_protocol_checker; import vr_xserial/e/vr_xserial_end_test_h; import vr_xserial/e/vr_xserial_package; import vr_xserial/e/vr_xserial_scoreboard_h; '>