-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathfpu_top_cfg.svh
More file actions
78 lines (66 loc) · 2.72 KB
/
Copy pathfpu_top_cfg.svh
File metadata and controls
78 lines (66 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* Copyright (c) 2025 CEA*
* *Commissariat a l'Energie Atomique et aux Energies Alternatives (CEA)
*
* SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
*
* Licensed under the Solderpad Hardware License v 2.1 (the “License”); you
* may not use this file except in compliance with the License, or, at your
* option, the Apache License version 2.0. You may obtain a copy of the
* License at
*
* https://solderpad.org/licenses/SHL-2.1/
*
* Unless required by applicable law or agreed to in writing, any work
* distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
/*
* Authors : Ihsane TAHIR
* Creation Date : March, 2025
* Description : Top configuration of the CVFPU UVM testbench
* History :
*/
class fpu_top_cfg extends uvm_object;
`uvm_object_utils(fpu_top_cfg);
rand bit m_reset_on_the_fly;
rand bit m_flush_on_the_fly;
// Number of transactions in a sequence
int num_txn;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function new(string name = "fpu_top_cfg");
super.new(name);
if (!$value$plusargs("NB_TXNS=%d", num_txn )) begin
num_txn = 10000;
end
`uvm_info( get_full_name(), $sformatf("NUM_TXN=%0d", num_txn), UVM_HIGH );
endfunction
// ---------------------------------------------
// API
// ---------------------------------------------
virtual function bit get_reset_on_the_fly();
return m_reset_on_the_fly;
endfunction
virtual function bit get_flush_on_the_fly();
return m_flush_on_the_fly;
endfunction
virtual function int get_num_txn();
return num_txn;
endfunction
// ------------------------------------------------------------------------
// convert2string
// ------------------------------------------------------------------------
virtual function string convert2string;
string s;
s = super.convert2string();
s = { s, $sformatf( "Reset on the Fly =%0d, " , m_reset_on_the_fly) };
s = { s, $sformatf( "Flush on the Fly =%0d, " , m_flush_on_the_fly) };
return s;
endfunction: convert2string
constraint reset_on_the_fly_c {m_reset_on_the_fly dist {1 := 10, 0 := 90};} // insert reset on the fly 10% of the time
constraint flush_on_the_fly_c {m_flush_on_the_fly dist {1 := 50, 0 := 50};} // insert flush on the fly 50% of the time
endclass : fpu_top_cfg