```c++
如下代码:
`timescale 1ns/1ps
`include "uvm_macros.svh"
import uvm_pkg::*;
class my_obj1 extends uvm_test;
`uvm_component_utils(my_obj1)
rand int src=4;
rand int dst;
constraint dst_c {
dst inside {[7:9]};
}
rand bit [3:0] crc = 4'b0111;
constraint crc_c {
crc inside {5,6,7,8};
}
function new(string name = "my_obj1" , uvm_component parent = null );
super.new(name, parent);
endfunction // new
extern virtual function print ();
extern virtual function pure_print ();
virtual task run_phase(uvm_phase phase);
super.run_phase(phase);
endtask
endclass //
function my_obj1::print();
randomize (src) with {(src) inside {[5:5]};} ;
`uvm_info(get_type_name(),$psprintf("%0h,%0h,%0h",src,dst,crc),UVM_LOW)
endfunction
function my_obj1::pure_print();
`uvm_info(get_type_name(),$psprintf("%0h,%0h,%0h",src,dst,crc),UVM_LOW)
endfunction
//////////////////////////////
module tb();
import uvm_pkg::*;
`include "uvm_macros.svh"
initial begin
run_test("my_obj1");
end
endmodule // tb
```c++
=======================================================
Solver failed when solving following set of constraints
integer dst = 0;
constraint dst_c // (from this) (constraint_mode = ON) (lab__uvm_base.sv:15)
{
(dst inside {[7:9]});
}
=======================================================
Info-[CNST-SATE] A standalone test-case for this failure has automatically been extracted
from randomize serial 1 partition 2.
To reproduce the error using the extracted testcase, please use the
following command:
cd
/home/autumn/project/uvm_learning/lab__uvm_class_randomize_01/./simv.cst/testcases;
vcs -sverilog extracted_r_1_p_2_inconsistent_constraints.sv -R
请问: 代码中,明明是 randomize(src) , 为什么报错 dst 求解失败呢?