New and active ways to bind to your design
description
Transcript of New and active ways to bind to your design
![Page 1: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/1.jpg)
New and active waysto bind to your design
byKaiming Ho
Fraunhofer IIS
![Page 2: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/2.jpg)
Sponsored By:
2 of 15
Overview:• Introduction and Motivation• Key techniques and language constructs
from SystemVerilog• Example use case
![Page 3: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/3.jpg)
Sponsored By:
3 of 15
Introduction• What does a ‘bind’ do?
– Insert “your” code into “others” code.
– as if you actually modified other designers code
• Why?– Modifying others code
not allowed / undesirable
– Keep DV code separate from design code• Hope to reuse.
DVcode
DUT
![Page 4: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/4.jpg)
Sponsored By:
4 of 15
Introduction• Could have kept code
separate at top level and used hier. references
• Susceptible to hierarchy changes.
DUT
DVcode
xmrXMR ?
![Page 5: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/5.jpg)
Sponsored By:
5 of 15
What to bind?• What kind of DV code?
– assertions– coverage
• Active code?– Transactors– Generators– Monitors
• Once bound, how to communicate with and control?
DVcode
assertions coveragemonitors
passive
monitor generator
Testbench component
![Page 6: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/6.jpg)
Sponsored By:
6 of 15
SystemVerilog constructs that helpNeed to understand the following constructs
and design patterns:• Abstract base classes.
virtual class <...>; pure virtual task ... pure virtual function ...
• Packages– Encapsulate abstract base classes– Implement lookup table
• up-module referencesLRM §23.8.1 (upwards name referencing)
![Page 7: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/7.jpg)
Sponsored By:
7 of 15
All transactors have an API.– Translate your wishes into signal wiggles.
• Define tasks/functions which make up API.• Implement as pure virtual class in package.
virtual class xactor_api; task drive_transaction(...); function T wait_for_transaction();
• Implement transactor.– Map signal wiggles to API & vice versa.– Extend base class. Construct an object.– Register object.
Abstract base classes
pure virtualpure virtual
![Page 8: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/8.jpg)
Sponsored By:
8 of 15
• API in previous slide is abstract base class– Need to extend
and implement• Construct object of
extended class.• Register into dropbox
Extend/Implement/Register
fill-in details
unique string
class my_xactor_api extends
xactor_api; task drive_transaction(...); // blah blah endtask function T
wait_for_transaction(); // blah blah endfunctionendclass
my_xactor_api _my_api = new;
initial bind_dropbox::register( $psprintf(“%m”), _my_api);
![Page 9: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/9.jpg)
Sponsored By:
9 of 15
BIND• TB binds xactor into DUT
RECOVER• A lookup table implemented in a package.
– Globally visible. Singleton. (because it is in a package)– Associates “strings” with “API objects”
• Transactors REGISTER their APIs into dropbox @ time 0.• TB components RECOVER API objects afterwards.
bind dut_module xactor bind1 (...);
xactor_api my_apis[$];string hier_paths[$];bind_dropbox::recover(“bind1”, hier_paths, my_apis);
Bind & Recover
xactor binds intodut_module.
must match
![Page 10: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/10.jpg)
Sponsored By:
10 of 15
REGISTER• bound xactor registers API in dropbox.• %m is unique string -> used as key.
– last part is bind instance name (e.g. bind1)• xactor could be multiply instantiated (if target module is)
– multiple entries in dropbox.– last part for all are identical.
RECOVER• For each bind, TB component calls RECOVER
– Use bind instance name as key.• dropbox returns
– array of API objects matching key.– array of %m strings matching key.
• TB uses %m strings to separate multiply instantiated case.
Bind dropbox details
![Page 11: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/11.jpg)
Sponsored By:
11 of 15
Real Life example• Initializing
internal RAMs in SoC.– Contents of
SPRAM contain code/data for CPU.
– Must be initialized before reset.
• Need backdoor (zero time) methods
CPUcore
I-cache/I-tagmemories
D-cache/D-tagmemories
internaldata
scratchpad(DSPRAM)
internalinstructionscratchpad(ISPRAM)
![Page 12: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/12.jpg)
Sponsored By:
12 of 15
• Memory wrappers organized as follows:module ispram_16kB(…);
reg[7:0] mem[0:16383];
// synopsys translate_offfunction reg [7:0] read_byte(addr);
function void write_byte(addr, din);// synopsys translate_on
endmodule
Real Life example
2D array for memory(behavioural model)
helper functions
spram_mem_accessor
bind ispram_16kB spram_mem_accessor bind1();
![Page 13: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/13.jpg)
Sponsored By:
13 of 15
• spram_mem_accessor uses up-module reference.module spram_accessor();
function reg [7:0] _read_byte(addr); return read_byte(addr);endfunction
function void _write_byte(addr, din); write_byte(addr,din);endfunction
class my_mem_accessor extends mem_accessor_base; ...
my_mem_accessor _api = newinitial bind_dropbox::register(...);endmodule
Up-module reference
up-module ref.into host module.
abstract base class
CREATE/REGISTER
![Page 14: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/14.jpg)
Sponsored By:
14 of 15
Putting it all together• “xactor” to bind: spram_mem_accessor. API:
– function reg [7:0] read_byte(input [31:0] addr);– function void write_byte(input [31:0] addr, [7:0] din);
• bind target: SoC internal memories– bind ispram_16kB spram_mem_accessor bind1();– bind dspram_16kB spram_mem_accessor bind2();
• WHY? Runtime backdoor access. Init uProc program.– compile ‘C’ program. gcc -> ELF file.– convert ELF to SREC. objcopy –O srec *.elf– parse SREC to obtain addr/data pairs to write.– map addr to appropriate memory. Use API to
write bytes.• API was recovered with bind_dropbox::recover.
![Page 15: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/15.jpg)
Sponsored By:
15 of 15
Conclusion• Presented binding transactors which can be actively
controlled at runtime.• Key concepts:
– Abstract base classes– Packages– bind dropbox– upwards name referencing.
• Example use-case– Loading ‘C’ programs into full-chip SoC
simulations.– integrated hardware/software verification
![Page 16: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/16.jpg)
Sponsored By:
16 of 15
Thank you!
QUESTIONS?
![Page 17: New and active ways to bind to your design](https://reader036.fdocuments.in/reader036/viewer/2022062323/5681676e550346895ddc579f/html5/thumbnails/17.jpg)
Sponsored By:
17 of 15
Comparison with UVM• UVM uses interfaces.
– top level testbench instantiates interface– agents require virtual version of interface
• Exchange of virtual interface objects through resource db– very similar in to bind_dropbox– uvm_resource_db#(virtual serial_intf)::set
(“interfaces”, “vif”, hier.path.to.intf);– uvm_resource_db#(virtual serial_intf)::read_by_name
(“interfaces”, “vif”, vif);• Virtual interfaces are problematic when parameters exist.
vintf