├── LICENSE ├── README.md ├── demo.sh ├── doc └── dvcon2017_uvm_debug_lib_final.pdf ├── src ├── cl_text.svh ├── cl_types.svh ├── cl_util.svh ├── uvm_debug_core_util.sv ├── uvm_debug_dpi.c ├── uvm_debug_module.sv ├── uvm_debug_pkg.sv ├── uvm_debug_prompt.sv ├── uvm_debug_reg_util.sv └── uvm_debug_seq_util.sv └── uvm_examples ├── Makefile.ius ├── Makefile.questa ├── Makefile.vcs └── integrated ├── README.txt ├── apb ├── apb.sv ├── apb_agent.sv ├── apb_config.sv ├── apb_if.sv ├── apb_master.sv ├── apb_monitor.sv ├── apb_rw.sv └── apb_sequencer.sv ├── codec ├── Makefile.ius ├── Makefile.questa ├── Makefile.vcs ├── README.txt ├── apb2txrx.svh ├── block_diagram.pdf ├── debug.cmd ├── demo.sh ├── dut.sv ├── reg_model.svh ├── sym_sb.svh ├── tb_env.svh ├── tb_top.sv ├── test.sv ├── testlib.svh └── vip │ ├── vip.sv │ ├── vip_agent.svh │ ├── vip_driver.svh │ ├── vip_if.sv │ ├── vip_monitor.svh │ ├── vip_seqlib.svh │ └── vip_tr.svh └── ubus ├── examples ├── Makefile.ius ├── Makefile.questa ├── Makefile.vcs ├── dut_dummy.v ├── test_lib.sv ├── ubus_example_master_seq_lib.sv ├── ubus_example_scoreboard.sv ├── ubus_example_tb.sv ├── ubus_tb_top.sv └── vsim.do └── sv ├── ubus_bus_monitor.sv ├── ubus_env.sv ├── ubus_if.sv ├── ubus_master_agent.sv ├── ubus_master_driver.sv ├── ubus_master_monitor.sv ├── ubus_master_seq_lib.sv ├── ubus_master_sequencer.sv ├── ubus_pkg.sv ├── ubus_slave_agent.sv ├── ubus_slave_driver.sv ├── ubus_slave_monitor.sv ├── ubus_slave_seq_lib.sv ├── ubus_slave_sequencer.sv ├── ubus_transfer.sv └── ubus_version.svh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Microsemi 4 | http://www.microsemi.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #UVM interactive debug library (uvm_debug) 2 | **Horace Chan (horace.chan@microsemi.com)** 3 | 4 | uvm_debug library is a free, open-source library writter in SystemVerilog and C (SV-DPI). uvm_debug is provided under MIT license and it available on GitHub. 5 | 6 | ##Documents: 7 | The PDF of the DVCON2017 titled "UVM Interactive Debug Library: Shortening the Debug Turnaround Time" is availabled at `doc/dvcon2017_uvm_debug_lib_final.pdf` 8 | 9 | ##Installation: 10 | 1. `git clone https://github.com/uvmdebug/uvm_debug` 11 | 2. Compile the .sv and .c files with the testbench 12 | 3. Instantiate the uvm_debug_module as a top level module 13 | 14 | ##Testbench Setup: 15 | - See Section B of the PDF 16 | 17 | ##Demo (ncsim only): 18 | Run `>./demo.sh` 19 | -------------------------------------------------------------------------------- /demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/tcsh -f 2 | 3 | cd uvm_examples/integrated/codec 4 | ./demo.sh 5 | -------------------------------------------------------------------------------- /doc/dvcon2017_uvm_debug_lib_final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uvmdebug/uvm_debug/cb55ff47e7e10187cc7718dcac673a700658bd22/doc/dvcon2017_uvm_debug_lib_final.pdf -------------------------------------------------------------------------------- /src/cl_types.svh: -------------------------------------------------------------------------------- 1 | //============================================================================== 2 | // cl_types.svh (v0.6.1) 3 | // 4 | // The MIT License (MIT) 5 | // 6 | // Copyright (c) 2013, 2014, 2015, 2016 ClueLogic, LLC 7 | // http://cluelogic.com/ 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | // SOFTWARE. 26 | //============================================================================== 27 | 28 | // Title: Type Definitions 29 | 30 | `ifndef CL_TYPES_SVH 31 | `define CL_TYPES_SVH 32 | 33 | //------------------------------------------------------------------------------ 34 | // Typedef: string_q 35 | // The queue of strings. 36 | //------------------------------------------------------------------------------ 37 | 38 | typedef string string_q[$]; 39 | 40 | //------------------------------------------------------------------------------ 41 | // Typedef: three_strings 42 | // The array of three strings. 43 | //------------------------------------------------------------------------------ 44 | 45 | typedef string three_strings[3]; 46 | 47 | //------------------------------------------------------------------------------ 48 | // Typedef: fg_color_e 49 | // The enumerated type of foreground colors. 50 | //------------------------------------------------------------------------------ 51 | 52 | typedef enum { FG_BLACK = 30, 53 | FG_RED = 31, 54 | FG_GREEN = 32, 55 | FG_YELLOW = 33, 56 | FG_BLUE = 34, 57 | FG_MAGENTA = 35, 58 | FG_CYAN = 36, 59 | FG_WHITE = 37 } fg_color_e; 60 | 61 | //------------------------------------------------------------------------------ 62 | // Typedef: bg_color_e 63 | // The enumerated type of background colors. 64 | //------------------------------------------------------------------------------ 65 | 66 | typedef enum { BG_BLACK = 40, 67 | BG_RED = 41, 68 | BG_GREEN = 42, 69 | BG_YELLOW = 43, 70 | BG_BLUE = 44, 71 | BG_MAGENTA = 45, 72 | BG_CYAN = 46, 73 | BG_WHITE = 47 } bg_color_e; 74 | 75 | `endif 76 | 77 | //============================================================================== 78 | // Copyright (c) 2013, 2014, 2015, 2016 ClueLogic, LLC 79 | // http://cluelogic.com/ 80 | //============================================================================== 81 | -------------------------------------------------------------------------------- /src/cl_util.svh: -------------------------------------------------------------------------------- 1 | //============================================================================== 2 | // 3 | // cl_util.svh (v0.6.1) 4 | // 5 | // The MIT License (MIT) 6 | // 7 | // Copyright (c) 2013, 2014, 2015, 2016 ClueLogic, LLC 8 | // http://cluelogic.com/ 9 | // 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to deal 12 | // in the Software without restriction, including without limitation the rights 13 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | // SOFTWARE. 27 | //============================================================================== 28 | 29 | `ifndef CL_UTIL_SVH 30 | `define CL_UTIL_SVH 31 | 32 | //------------------------------------------------------------------------------ 33 | // Class: util 34 | // (VIRTUAL) Provides several utility functions. 35 | // 36 | // See Also: 37 | // 38 | //------------------------------------------------------------------------------ 39 | 40 | virtual class util; 41 | 42 | //--------------------------------------------------------------------------- 43 | // Function: num_oct_digits 44 | // (STATIC) Returns the number of octal digits required to represent the 45 | // specified binary digits. 46 | // 47 | // Argument: 48 | // num_bin_digits - The number of binary digits. 49 | // 50 | // Returns: 51 | // The number of octal digits required to represent *num_bin_digits*. 52 | // 53 | // Example: 54 | // | assert( util::num_oct_digits( 3 ) == 1 ); // 3'b111 -> 1'o7 55 | // | assert( util::num_oct_digits( 4 ) == 2 ); // 4'b1111 -> 2'o17 56 | //--------------------------------------------------------------------------- 57 | 58 | static function int unsigned num_oct_digits( int unsigned num_bin_digits ); 59 | return ( num_bin_digits + 2 ) / 3; 60 | endfunction: num_oct_digits 61 | 62 | //--------------------------------------------------------------------------- 63 | // Function: num_dec_digits 64 | // (STATIC) Returns the number of decimal digits required to represent the 65 | // specified binary digits. 66 | // 67 | // Argument: 68 | // num_bin_digits - The number of binary digits. 69 | // 70 | // Returns: 71 | // The number of decimal digits required to represent *num_bin_digits*. 72 | // 73 | // Example: 74 | // | assert( util::num_dec_digits( 3 ) == 1 ); // 3'b111 -> 1'd7 75 | // | assert( util::num_dec_digits( 4 ) == 2 ); // 4'b1111 -> 2'd15 76 | //--------------------------------------------------------------------------- 77 | 78 | static function int unsigned num_dec_digits( int unsigned num_bin_digits ); 79 | if ( num_bin_digits == 0 ) return 0; 80 | 81 | // log10( 2 ^ n ) + 1 = n * log10( 2 ) + 1 82 | // $rtoi converts real values to an 'integer' type by truncating the real 83 | // value. ^^^^^^^^^^ 84 | 85 | return $rtoi( num_bin_digits * $log10( 2 ) ) + 1; 86 | endfunction: num_dec_digits 87 | 88 | //--------------------------------------------------------------------------- 89 | // Function: num_hex_digits 90 | // (STATIC) Returns the number of hexadecimal digits required to represent 91 | // the specified binary digits. 92 | // 93 | // Argument: 94 | // num_bin_digits - The number of binary digits. 95 | // 96 | // Returns: 97 | // The number of hexadecimal digits required to represent *num_bin_digits*. 98 | // 99 | // Example: 100 | // | assert( util::num_hex_digits( 3 ) == 1 ); // 3'b111 -> 1'h7 101 | // | assert( util::num_hex_digits( 4 ) == 1 ); // 4'b1111 -> 1'hF 102 | //--------------------------------------------------------------------------- 103 | 104 | static function int unsigned num_hex_digits( int unsigned num_bin_digits ); 105 | return ( num_bin_digits + 3 ) / 4; 106 | endfunction: num_hex_digits 107 | 108 | //--------------------------------------------------------------------------- 109 | // Function normalize 110 | //--------------------------------------------------------------------------- 111 | 112 | static function void normalize( int len, 113 | ref int start_pos, 114 | ref int end_pos ); 115 | if ( len == 0 ) begin 116 | start_pos = 0; 117 | end_pos = 0; 118 | return; 119 | end 120 | if ( start_pos < 0 ) start_pos += len; 121 | if ( start_pos < 0 ) start_pos = 0; 122 | if ( end_pos < 0 ) end_pos += len; 123 | if ( end_pos >= len ) end_pos = len - 1; 124 | endfunction: normalize 125 | 126 | endclass: util 127 | 128 | `endif // `ifndef CL_UTIL_SVH 129 | 130 | //============================================================================== 131 | // Copyright (c) 2013, 2014, 2015, 2016 ClueLogic, LLC 132 | // http://cluelogic.com/ 133 | //============================================================================== 134 | -------------------------------------------------------------------------------- /src/uvm_debug_core_util.sv: -------------------------------------------------------------------------------- 1 | // MIT License 2 | // 3 | // Copyright (c) 2016 Microsemi 4 | // http://www.microsemi.com 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // ----------------------------------------------------------------------------- 25 | // Description: 26 | // 27 | // Core util functions to parse user inputs 28 | // 29 | // ----------------------------------------------------------------------------- 30 | 31 | import "DPI-C" function void dpi_tcl_exec_cmd(string cmd); 32 | import "DPI-C" function void dpi_read_line(string prompt, inout string line); 33 | import "DPI-C" function void dpi_get_sbuffer(inout string line); 34 | 35 | // data type 36 | typedef int qint[$]; 37 | 38 | // -------------------------------------------------------------- 39 | // util functions for debug prompt argument parsing 40 | // -------------------------------------------------------------- 41 | 42 | // extract options in the arguments 43 | // store the options and value pair into an associate array 44 | // support both "-