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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [defin_lib.svh] - Diff between revs 2 and 3

Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 1... Line 1...
//-----------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
//
//
//                             UART2BUS VERIFICATION
//                             UART2BUS VERIFICATION
//
//
//-----------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// CREATOR    : HANY SALAH
// CREATOR    : HANY SALAH
// PROJECT    : UART2BUS UVM TEST BENCH
// PROJECT    : UART2BUS UVM TEST BENCH
// UNIT       : DEFINITION LIBRARY
// UNIT       : DEFINITION LIBRARY
//-----------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// TITLE      : UART Definition Library
// TITLE      : UART DEFINITION LIBRARY
// DESCRIPTION: This
// DESCRIPTION: THIS LIBRARY INCLUDES ALL THE USER MACROSES, TIMESCALE, TRANSACTION DATA TYPES,
//-----------------------------------------------------------------------------
//              GLOBAL FUNCTIONS AND CONFIGURATION DATA TYPES
 
//-------------------------------------------------------------------------------------------------
// LOG DETAILS
// LOG DETAILS
//-------------
//-------------
// VERSION      NAME        DATE        DESCRIPTION
// VERSION      NAME        DATE        DESCRIPTION
//    1       HANY SALAH    25122015    FILE CREATION
//    1       HANY SALAH    25122015    FILE CREATION
//    2       HANY SALAH    31122015    ADD DATA TYPE DEFINITIONS
//    2       HANY SALAH    31122015    ADD DATA TYPE DEFINITIONS
//    3       HANY SALAH    11012016    ADD TIMING PARAMETERS DEFINITION
//    3       HANY SALAH    11012016    ADD TIMING PARAMETERS DEFINITION
//-----------------------------------------------------------------------------
//    4       HANY SALAH    18022016    IMPROVE BLOCK DESCRIPTION
// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR
//-------------------------------------------------------------------------------------------------
// OPENCORES MEMBERS ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE
// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR OPENCORES MEMBERS
// CREATOR'S PERMISSION
// ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE CREATOR'S PERMISSION
//-----------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
 
 
`timescale 1ns/1ns
`timescale 1ns/1ns
//------------------------------------------
 
 
//-------------------------------------------------------------------------------------------------
//
//
//  Definition Identifiers
//  Definition Identifiers
//
//
//------------------------------------------
//-------------------------------------------------------------------------------------------------
 
 
 
  // Define high value
 
  `define one 1'b1
 
 
 
  // Define low value
 
  `define zero 1'b0
 
 
  // Define size of address line
  // Define size of address line
  `define size  16
  `define size  16
 
 
  // 2 power size
  // 2 power size
Line 80... Line 89...
  `define text_mode     1
  `define text_mode     1
 
 
  // Binary Mode Command
  // Binary Mode Command
  `define binary_mode   2
  `define binary_mode   2
 
 
  // Wrong Mode Command
  // Wrong Mode text Command
  `define wrong_mode    3
  `define wrong_mode_txt 3
 
 
 
  // Wrong Mode bin Command
 
  `define wrong_mode_binry 4
 
 
  // Read Command
  // Read Command
  `define read_comm     1
  `define read_comm     1
 
 
  // write Command
  // write Command
  `define write_comm    2
  `define write_comm    2
 
 
  // nop Command
  // nop Command
  `define nop_comm      3
  `define nop_comm      3
 
 
  // wrong Command
  // wrong Read Command
  `define wrong_comm    4
  `define wrong_comm_read 4
 
 
 
  // wrong Write Command
 
  `define wrong_comm_write 5
 
 
  // Use single white space
  // Use single white space
  `define single_space  1
  `define single_space  1
 
 
  // Use multiple white space
  // Use multiple white space
Line 145... Line 160...
  // Read Control
  // Read Control
  `define read_ctrl     2'b01
  `define read_ctrl     2'b01
 
 
  // Write Control
  // Write Control
  `define write_ctrl    2'b10
  `define write_ctrl    2'b10
//------------------------------------------
 
 
  // Invalid Control
 
  `define invalid_ctrl  2'b11
 
 
 
  `define _parityoff    1
 
 
 
  `define _parityeven   2
 
 
 
  `define _parityodd    3
 
//-------------------------------------------------------------------------------------------------
//
//
//  Timing Defines
//  Timing Defines
//
//
//------------------------------------------
//-------------------------------------------------------------------------------------------------
  // Define stability time
  // Define stability time
  `define stab               10
  `define stab               10
 
 
  // Define the period of global clock in terms of ns
  // Define the period of global clock in terms of ns
  `define glob_clk_period    25
  `define glob_clk_period    25
 
 
  // Define the period of baud clock in terms of ns
  // Define the period of baud clock in terms of ns
  `define buad_clk_period    8680
  `define buad_clk_period    8680
//------------------------------------------
 
 
//-------------------------------------------------------------------------------------------------
//
//
//  Configuration Data Type
//  Configuration Data Type
//
//
//------------------------------------------
//-------------------------------------------------------------------------------------------------
 
 
// Represents the active edge
// Represents the active edge
typedef enum {pos_edge=1,            // Based on positive edge
typedef enum {pos_edge=1,            // Based on positive edge
              neg_edge=2} act_edge;  // Based on negative edge
              neg_edge=2} act_edge;  // Based on negative edge
 
 
// Represent the starting bit
// Represent the starting bit
typedef enum {msb=1,                 // Most Significant bit first
typedef enum {msb=1,                 // Most Significant bit first
              lsb=2}  start_bit;     // Least Significant bit first
              lsb=2}  start_bit;     // Least Significant bit first
 
 
//------------------------------------------
//-------------------------------------------------------------------------------------------------
//
//
//  New Data Type Definitions
//  New Data Type Definitions
//
//
//------------------------------------------
//-------------------------------------------------------------------------------------------------
 
 
  // Represents the mode of command to be one of the following options {text, command, wrong}. Wrong
  // Represents the mode of command to be one of the following options {text, command, wrong}.
  // command mode is used to send a tricky fault command to test our DUT.
  // Wrong command mode is used to send a tricky fault command to test our DUT.
  typedef enum {text=1,                    // Communicate using text mode
  typedef enum {text=1,                    // Communicate using text mode
                binary=2,                  // Communicate using command mode
                binary=2,                  // Communicate using command mode
                wrong_mode=3} mode;        // Communicate using wrong prefix
                wrong_mode_text=3,              // Communicate using wrong prefix(text mode)
 
                wrong_mode_bin=4} mode;         // Communicate using wrong prefix(binary mode)
 
 
  // Represents the type of the used white space to be one of the following options {single, tab, wrong}.
  // Represents the type of the used white space to be one of the following options {single, tab,
  // Wrong type also is used to push tricky byte in the text mode.
  // wrong}. Wrong type also is used to push tricky byte in the text mode.
  typedef enum {single=1,             // Using single space as a white space
  typedef enum {single=1,             // Using single space as a white space
                tab=2,                // Using tab as a white space
                tab=2,                // Using tab as a white space
                wrong_space=3} space_type;  // Using wrong white space
                wrong_space=3} space_type;  // Using wrong white space
 
 
  // Represents the type of end of line used to be one of the following choices{cr, lf, wrong}.
  // Represents the type of end of line used to be one of the following choices{cr, lf, wrong}.
Line 200... Line 226...
 
 
  // Represents the command either to be one of the following choices {read, write, NOP}
  // Represents the command either to be one of the following choices {read, write, NOP}
  typedef enum {read=1,               // Read Command
  typedef enum {read=1,               // Read Command
                write=2,              // Write Command
                write=2,              // Write Command
                nop=3,                // Make No Operation
                nop=3,                // Make No Operation
                invalid=4} command;   // Invalid command value
                invalid_read=4,             // Invalid Command with read data
 
                invalid_write=5} command;   // Invalid Command with write data
 
 
  // Represents both acknowledge and incremental address request{yes, no}
  // Represents both acknowledge and incremental address request{yes, no}
  typedef enum {yes=1,                // Request Acknowledge
  typedef enum {yes=1,                // Request Acknowledge
                no=2} req;            // Request No Acknowledge
                no=2} req;            // Request No Acknowledge
 
 
Line 215... Line 242...
  // Represents the internal bus state either {accept, refuse}
  // Represents the internal bus state either {accept, refuse}
  typedef enum {accept=1,             // Accept Bus Grant
  typedef enum {accept=1,             // Accept Bus Grant
                declain=2} arbit;     // Refuse Bus Grant
                declain=2} arbit;     // Refuse Bus Grant
 
 
  // Define mode of data {ascii or binary}
  // Define mode of data {ascii or binary}
  typedef enum {bin=1,
  typedef enum {bin=1,                // Binary Representation (data remains unchanged)
                ascii=2} data_mode;
                ascii=2} data_mode;   // ASCII Representation  (each niblle is converted into
 
                                      // ASCII byte)
 
 
  // Define mode of the used parity
  // Define mode of the used parity
  typedef enum {parity_off=1,
  typedef enum {parity_off=1,                 // Don't Add Parity Field
                parity_even=2,
                parity_even=2,                // Add Even Parity to fields
                parity_odd=3}  parity_mode ;
                parity_odd=3}  parity_mode ;  // Add Odd Parity to fields
 
 
//-------------------------------------------------------
//-------------------------------------------------------------------------------------------------
//
//
//      GLOBAL FUNCTION
//                                 GLOBAL FUNCTIONS
//
//
//-------------------------------------------------------
//-------------------------------------------------------------------------------------------------
 
 
// Binary To ASCII Conversion to convert nibble into ASCII byte through the following look-up-table
  // Binary To ASCII Conversion to convert nibble into ASCII byte through the following look-up-
 
  // table
function byte bin_asci_conv (bit[3:0] data);
function byte bin_asci_conv (bit[3:0] data);
  byte temp;
  byte temp;
  case (data)
  case (data)
    4'h0:
    4'h0:
      begin
      begin
Line 301... Line 330...
      end
      end
  endcase
  endcase
  return temp;
  return temp;
endfunction:bin_asci_conv
endfunction:bin_asci_conv
 
 
// ASCII To Binary Conversion is to convert ASCII byte into Binary nibble through the following Look-Up-Table
  // ASCII To Binary Conversion is to convert ASCII byte into Binary nibble through the following
 
  // Look-Up-Table
function bit [3:0] asci_bin_conv (byte data);
function bit [3:0] asci_bin_conv (byte data);
  bit [3:0] temp;
  bit [3:0] temp;
  case (data)
  case (data)
    8'h30:
    8'h30:
      begin
      begin

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.