iosim.html 29.6 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) [Netscape]">
   <title>Iosim DV Environment</title>
</head>
<body>

<center>
<h2>
IOSIM DV Environment</h2></center>

<h3>
<b>&nbsp;</b>IOSIM Component</h3>
<img SRC="iosim.gif" ALT="" height=557 width=1141>
<p><font size=+1>1. IOSIM Test</font>
<p>&nbsp;&nbsp;&nbsp;&nbsp; Test itself, you can write it in .tst file
format(you can use tst2c to convert your tst file into "C" file later)
or write in "C".
<p>&nbsp;&nbsp;&nbsp;&nbsp; The ".tst" file format:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command&nbsp;
[parameters]
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The line
which starts is not command will be treat as comments(not runable),&nbsp;
to make less confusion and later extension, plese use "//" at the beginning
of the each comment line.
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The common used commands
are:
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>s &lt;stall cycles></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Ask bcp to move forward certain cycles.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
In "C", BCP_STALL(stall_cycles);
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b> t&nbsp;&nbsp; #id
parameter0 -3</b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
call the test function according to given id(which is defined as function
table in iotestcmd.c) with given four paramters.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
The prototype of test function is int Test_name(int, int, int, int).
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
In "C", Test_name(p1, p2, p3, p4);&nbsp;&nbsp; <i><font size=-1>/* return
-1 if test fail */</font></i>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b> k 0/1</b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Keep/Close persist socket connections.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Persist socket connect will save socket setup overhead times, so if you
do a lot of IOs with simulator, please use persistent connection.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Please remember to close it when test is done or switching between tests.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
In "C",&nbsp; do_keep_alive_socket(1/0);
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b> d&nbsp; string</b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Ask simulator to display any message(&lt;64 byte) for debugging purpose.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
In "C", displayMsg("message body");
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>dump 0/1</b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Turn on/off verilog dump
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b> q</b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Stop simulator, in "C",&nbsp; IoCmd(REQ_QUIT, 0).
<br>&nbsp;
<p><font size=+1>2. Test APIs</font>
<p>&nbsp;&nbsp;&nbsp;&nbsp; In theory, we can write tests only based on
atomic APIs, but it is very hard if we do not have loop/condition mechanisms.&nbsp;
Test APIs are routines written in "C" to call atomic APIs to achieve certain
functions.
<p><font size=+1>2.1 General Test APIs</font>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Those APIs cab be used for testing
different components.
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><a href="#InitDDR">InitDDR(
)</a></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Initialize DDR memory controller.
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b><a href="#register_test">register_test(
)</a></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; General
register test.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you
use .tst file, test id is 202.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Note :
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
This test might not fit all registers.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
For example, SP_STATUS(0x4040010),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
but you still can use it to test bit from 2 to 31,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
then use MemWriteRead or MemReadCompMask to test bit 0 and 1.
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#MemRead">MemRead(
)</a>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Memory/register/sram read(From RCP).
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.tst id is: 100
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#MemReadCompare">MemReadCompare(
)</a>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Memory/register/sram read and comparison. (From RCP)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.tst id is: 101
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#MemWrite">MemWrite(
)</a>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Memory/reg/sram write. (From RCP)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.tst id is: 102
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#MemWriteRead">MemWriteRead(
)</a>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Memory/reg/sram write, read back and compare. (From RCP)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.tst id is: 103
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#MemReadCompMask">MemReadCompMask()</a>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Memory read and compare with given mask. (From RCP)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.tst id is: 108
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; More will be add here. (some
from old RCP)
<p><font size=+1>2.2 Specific Test APIs</font>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Those APIs are written for specific
components. For examples, AiDmaTests for AI component only.
<p><font size=+1>3. Atomic API</font>
<p>&nbsp;&nbsp;&nbsp; You are highly recommended to use those functions
to build your tests.
<p>&nbsp;&nbsp;&nbsp; The most common ones are:
<br>&nbsp;&nbsp;&nbsp; (a) <b><a href="#IO_READ">IO_READ( )&nbsp;</a>&nbsp;&nbsp;&nbsp;
&amp;&nbsp;&nbsp;&nbsp; <a href="#IO_WRITE">IO_WRITE( )</a></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Read or write a single
word(4 bytes) into memory or register. Please note,&nbsp; those API will
handle endian(as integer) for you.
<p>&nbsp;&nbsp;&nbsp; (b) <b><a href="#SIM_TIME">SIM_TIME( )</a></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get simulator uptime
in ns. You might need this for timeout function or debug.
<p>&nbsp;&nbsp;&nbsp; (c) <b><a href="#BD_IO_READ">BD_IO_READ( )</a>&nbsp;&nbsp;
&amp;&nbsp; <a href="#BD_IO_WRITE">BD_IO_WRITE( )</a></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Backdoor memory read/write
a single word(4 bytes)
<p>&nbsp;&nbsp;&nbsp; (d) <b><a href="#BCP_STALL">BCP_STALL( )</a></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Let BCP move
forward the given system clks.
<p>&nbsp;&nbsp;&nbsp; (e)&nbsp; <b><a href="#CHECK_INTERRUPT">CHECK_INTERRUPT</a></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Return interrupt info at last i/o operation.
<p>&nbsp;&nbsp;&nbsp; (f) <b><a href="#_TRACE">_TRACE( )</a></b>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Iosim trace functions.
<p>&nbsp;&nbsp;&nbsp; If you want to handle x/z, you can use the following
functions:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
V_IO_SREAD_BYTE( ),&nbsp; V_IO_SREAD_HWORD( ) and V_IO_SREAD_WORD( )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
V_IO_SWRITE_BYTE( ), V_IO_SWRITE_HWORD, V_IO_SWRITE_WORD( )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
with prefix BD, it will change to backdoor memory access functions.
<br>&nbsp;&nbsp;&nbsp; To handle x,z, a new data structure is introduced,
<br>&nbsp;&nbsp;&nbsp; <i><font size=-1>struct {</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int
data_part, xz_part;</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } V_INT, *PV_INT;</font></i>
<table BORDER COLS=3 WIDTH="200" NOSAVE >
<tr>
<td>
<center>data_part</center>
</td>

<td>xz_part</td>

<td>
<div align=right>Result</div>
</td>
</tr>

<tr>
<td>
<div align=right>0</div>
</td>

<td>
<div align=right>0</div>
</td>

<td>
<div align=right>0</div>
</td>
</tr>

<tr>
<td>
<div align=right>1</div>
</td>

<td>
<div align=right>0</div>
</td>

<td>
<div align=right>1</div>
</td>
</tr>

<tr>
<td>
<div align=right>0</div>
</td>

<td>
<div align=right>1</div>
</td>

<td>
<div align=right>z</div>
</td>
</tr>

<tr>
<td>
<div align=right>1</div>
</td>

<td>
<div align=right>1</div>
</td>

<td>
<div align=right>x</div>
</td>
</tr>
</table>

<p>&nbsp;&nbsp;&nbsp; There are also block read/write functions if you
have to read/write big chunk of data(Say, > 64Kbytes &lt;current less than
1sec via backdoor single I/O>).
<br>&nbsp;&nbsp;&nbsp; V_IO_BREAD( ), V_IO_BWRITE( ), BD_V_IO_BREAD( )&nbsp;
and BD_V_IO_BWRITE( )
<p>&nbsp;<font size=+1>4. PLI function</font>
<p>&nbsp;&nbsp;&nbsp;&nbsp; In general, you do not need to worry about
those APIs unless you want to change ipc mechanism.
<p><font size=+1>5. Misc</font>
<p><font size=+1>&nbsp;&nbsp;&nbsp; 5.1&nbsp;<a NAME="General Rule"></a>General
Rule</font>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;
If the test failed, return -1. (.tst file request)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Please also use _TRACE(DERROR, ...) to report error
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* All new component test (like pi, si, usb, etc) should be in directory(iosim/src/test_name)
as Andy suggested.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* Please use _TRACE as log mechanism.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
I will port all others(like fprintf(stderr...) in all existing tests.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* If Error occur, please write "ERROR" in log file.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
After test is done, grep ERROR or Failed(.tst generated) to make sure all
test are passed.
<p><font size=+1>Reference:</font>
<p><a NAME="_TRACE"></a><b>_TRACE</b>
<br>Macro&nbsp;&nbsp; _TRACE(type, code)
<br>Description:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If certain type is set,
execute the code.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In general, the code will
be fprintf(LogFp, ...)
<br>Header file:&nbsp; trace.h
<br>Parameter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type -- trace type
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<font size=-1>DALL
(0xFFFFFFFF) :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; All debug
types</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DERROR(0x00000001):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DREAD(0x00000002 ):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Read tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DWRITE(0x00000004):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DSIGNAL(0x00000008):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Signal tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DINST(0x00000010):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Instruction tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DREGS(0x00000020 ):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Register tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DLOG (0x00000040):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Log tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DTRANS (0x00000080)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IO
R/W tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DSTATUS(0x00000100)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status tracing</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DCOMPARE(0x00000200)&nbsp; Data compare tracing */</font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; code -- "C" code
<br>Note:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you use .tst file, specify
"-d trace_type(hex) -l logfile".
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In "C", set global varible:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Dflags --- Your trace type
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
LogFp = fopen("your log file name here", "w");
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you do not specify log
file, it will output to stderr.
<p>Examples:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size=-1>if (timeout)</font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size=-1>_TRACE(DERROR,
fprintf(LogFp, "ERROR: BCP timeout"));</font>
<p><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dma_addr =
IO_READ(Address_of_DMA_current);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _TRACE(DCOMPARE,
fprintf(LogFp, "Info: current dma addr=%x", dma_current));</font>
<p><a NAME="BCP_STALL"></a><b>BCP_STALL</b>
<br>Macro: BCP_STALL(cycles)
<br>Description: Let simulator move forward given cycles.
<br>Header file:&nbsp; bcp_util.h
<br>Paramter: number of BB cycles
<br>Examples:
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* write to memory in x36 mode, backdoor&nbsp; read back in x64 mode */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IO_WRITE(0x00000000,
0xbabecafe);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BCP_STALL(10);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* stall to wait for writing is done */</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = BD_IO_READ(0x01000000);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ret !=
0xbabecafe)&nbsp;&nbsp; /* Error occured*/</font>
<p><a NAME="BD_IO_READ"></a><b>BD_IO_READ</b>
<br>macro: BD_IO_READ( address)
<br>Description:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Read data at given memory
address via memory backdoor.
<br>Header file: bcp_util.h
<br>Parameter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address --- BB memory space.
(x36/x64 mode)
<br>Examples:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i> <font size=-1>/*
write to memory in x36 mode, backdoor&nbsp; read back in x64 mode */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IO_WRITE(0x00000000,
0xbabecafe);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BCP_STALL(10);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/* stall to wait for writing is done */</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = BD_IO_READ(0x01000000);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ret !=
0xbabecafe)&nbsp;&nbsp; /* Error occured*/</font>
<p><a NAME="BD_IO_WRITE"></a><b>BD_IO_WRITE</b>
<br>macro: BD_IO_WRITE( address, data)
<br>Description:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write data to given memory
address via memory backdoor.
<br>Header file: bcp_util.h
<br>Parameter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address --- BB memory space.
(x36/x64 mode)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
--- writing data
<br>Examples:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i> <font size=-1>/*
write to memory in x64 mode via backdoor, then read back&nbsp; */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BD_IO_WRITE(0x010000000,
0xbabecafe);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = BD_IO_READ(0x00000000);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ret !=
0xbabecafe)&nbsp;&nbsp; /* Error occured*/</font>
<p><a NAME="CHECK_INTERRUPT"></a><b>CHECK_INTERRUPT</b>
<br>Macro: CHECK_INTERRUPT
<br>Description:
<br>&nbsp;&nbsp;&nbsp; BB interrupt at last ipc call.
<br>&nbsp;&nbsp;&nbsp; Bit 5 : NMI
<br>&nbsp;&nbsp;&nbsp; Bits 4-0: BB interrupts
<br>Examples:
<br>&nbsp;&nbsp; <font size=-1>int i, int_l, j;</font>
<p><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i>/* checkout interrupt
info every interval or timeout*/</i></font>
<br><font size=-1>&nbsp;&nbsp;&nbsp; for (i=j=1; i&lt;timeout; i+=interval,
j++) {</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int_l = CHECK_INTERRUPT;</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (int_l
&amp; 0x02) return 1;</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bcp_stall(interval);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (j % 250
== 0 ) displayMsg("* Wait for interrupt *");</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp; }</font>
<p><a NAME="InitDDR"></a><b>InitDDR</b>
<br>Function: int InitDDR(int, int, int, int)
<br>Description:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Initialize DDR memory controller
<br>Header file: bcptest.h
<br>Parameter: not used
<br>Return: 0
<br>Examples:
<br>&nbsp;&nbsp;&nbsp; <font size=-1>InitDDR(0, 0, 0, 0);</font>
<p><a NAME="IO_READ"></a><b>IO_READ</b>
<br>Macro: IO_READ( address)
<br>Description:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Read data at given memory
address,register or sram .
<br>Header file: iomap.h
<br>Parameter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address --- BB memory map
space
<br>Examples:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i> <font size=-1>/*
write to memory in x36 mode, then&nbsp; read back in x64 mode */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IO_WRITE(0x00000000,
0xbabecafe);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = IO_READ(0x01000000);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ret !=
0xbabecafe)&nbsp;&nbsp; /* Error occured*/</font>
<p><a NAME="IO_WRITE"></a><b>IO_WRITE</b>
<br>macro: IO_WRITE( address, data)
<br>Description:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write data to given memory
address/register/sram.
<br>Header file: bcp_util.h
<br>Parameter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address --- BB memory map
space.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
--- writing data
<br>Examples:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i> <font size=-1>/*
write to memory in x64 mode via backdoor, then read back&nbsp; */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IO_WRITE(0x010000000,
0xbabecafe);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ret = IO_READ(0x00000000);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ret !=
0xbabecafe)&nbsp;&nbsp; /* Error occured*/</font>
<p><a NAME="MemRead"></a><b>MemRead</b>
<br>Function:
<br>&nbsp;&nbsp;&nbsp; int MemRead(int addr, int a2, int a3, int a4);
<br>Description:
<br>&nbsp;&nbsp;&nbsp; call IO_READ to read data from reg/memory/sram.
<br>Header file:
<br>&nbsp;&nbsp;&nbsp; iotest.h
<br>Paramter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addr --- BB memory map space.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a2, a3, a4 --- extra
<br>Return 1
<br>Example:
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* in .tst
<i>t
100 00000004 00000000 00000000 0000000 */</i></font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemRead(0x4,
0, 0, 0);</font>
<p><a NAME="MemReadCompMask"></a><b>MemReadCompMask</b>
<br>Function:
<br>&nbsp;&nbsp;&nbsp; int MemReadCompMask(int addr, int data, int mask,
int failExpected);
<br>Description:
<br>&nbsp;&nbsp;&nbsp; call IO_READ to read data from reg/memory/sram and
compare it with data.
<br>Header file:
<br>&nbsp;&nbsp;&nbsp; iotest.h
<br>Paramter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addr --- BB memory map space.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data ---&nbsp; Expect data
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mask --- Compare mask
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failExpected --- supposed
to fail?
<br>Return -1 if failed(mismatch(&amp;mask) &amp;&amp; failExpect==0).
<br>Example:
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* in .tst
<i>t
108 04040010 00000000 00000001 0000000 */</i></font>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Read
Sp status and compare only on bit 0&nbsp; */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemReadCompMask(0x4040010,
0, 1, 0);</font>
<br><font size=-1>&nbsp;</font>
<br><a NAME="MemReadCompare"></a><b>MemReadCompare</b>
<br>Function:
<br>&nbsp;&nbsp;&nbsp; int MemReadCompare(int addr, int data, int a3, int
failExpected);
<br>Description:
<br>&nbsp;&nbsp;&nbsp; call IO_READ to read data from reg/memory/sram and
compare it with data.
<br>Header file:
<br>&nbsp;&nbsp;&nbsp; iotest.h
<br>Paramter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addr --- BB memory map space.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data --- Expect data
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a3 --- extra
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failExpected --- supposed
to fail?
<br>Return -1 if failed(mismatch &amp; failExpect==0).
<br>Example:
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* in .tst
<i>t
101 00000004 0000ffff 00000000 0000000 */</i></font>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Read
memory 4, and check if it equal 0xffff */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemReadCompare(0x4,
0xffff, 0, 0);</font>
<br><font size=-1>&nbsp;</font>
<br><a NAME="MemWrite"></a><b>MemWrite</b>
<br>Function:
<br>&nbsp;&nbsp;&nbsp; int MemWrite(int addr, int data, int a3, int a4);
<br>Description:
<br>&nbsp;&nbsp;&nbsp; call IO_WRITE to write data into reg/memory/sram.
<br>Header file:
<br>&nbsp;&nbsp;&nbsp; iotest.h
<br>Paramter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addr --- BB memory map space.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data ---&nbsp; data
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a3, a4--- extra
<br>Return 1
<br>Example:
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* in .tst
<i>t
102 00000004 0000ffff 00000000 0000000 */</i></font>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* write 0xffff
into&nbsp; memory 4 */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemWrite(0x4, 0xffff,
0, 0);</font><b></b>
<p><a NAME="MemWriteRead"></a><b>MemWriteRead</b>
<br>Function:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int MemWriteRead(int addr,
int data, int exp, int failExpected)
<br>Description:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Memory/reg/sram write, read back
and compare.
<br>Header file:
<br>&nbsp;&nbsp;&nbsp; iotest.h
<br>Paramter:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; addr --- BB memory map space.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data --- data write to memory/reg/sram
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exp&nbsp; ---&nbsp; expect
read back data
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; failExpected --- supposed
to fail?
<br>Return -1 if failed(mismatch &amp; failExpect==0).
<br>Example:
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* in .tst
<i>t
103 00000004 0000ffff 0000ffff 0000000 */</i></font>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* write/read
0xfffff to/from memory 4, and check if it equal 0xffff */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemReadCompare(0x4,
0xffff, 0xffff, 0);</font>
<br>&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font size=-1>/* <i>t 103 04040010 00000001
00000000 00000000</i></font>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Clear halt bit in SP then check , then check if it cleared.</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
t 103 04040010 00000001 00000001 00000001</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
The same but expect failure.</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
t 103 04040010 00000002 00000001 00000000</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Set halt bit, then check if halt get set.</font></i>
<br><i><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Those tests at&nbsp; reset time, otherwise you should use MemReadCompMask</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MemReadCompare(0x4040010, 1, 0, 0);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MemReadCompare(0x4040010, 1, 1, 1);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MemReadCompare(0x4040010, 2, 1, 0);</font>
<br>&nbsp;
<br><a NAME="register_test"></a><b>register_test</b>
<br>Function: int register_test(int addr, int rw_mask, int ronly_mask,
int extra)
<br>Description:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Register test.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Walk through bit from
0 to 31
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if rw_mask of this bit is set, write 0,1 to it, then read back, and check
if they are the same.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if ronly_mask is set,&nbsp; read this register to old_v(only read once),
write 0,1 to it, then read back, and check if it equals to the same bit
in old_v.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * put the random number
in this register, check if
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(write_data &amp; rw_mask ) == (read_data &amp; rw_mask)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(read_data &amp; ronly_mask) == (old_v &amp; ronly_mask)
<br>Header file:&nbsp; bcptest.h
<br>Parameters:
<br>&nbsp;&nbsp;&nbsp; addr --- BB register address
<br>&nbsp;&nbsp;&nbsp; rw_mask ---&nbsp; read/write bit mask
<br>&nbsp;&nbsp;&nbsp; ronly_mask --- read only bit mask
<br>&nbsp;&nbsp;&nbsp; extra --- not used
<br>Return:
<br>&nbsp;&nbsp;&nbsp; -1 if failed.
<p>Examples:
<br>&nbsp;&nbsp; <font size=-1>.tst file</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp; t 202 4001000 FFFFFFFF 00000000&nbsp;&nbsp;&nbsp;&nbsp;
00000000</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp; t 202 4080004 00000003&nbsp;&nbsp;&nbsp;&nbsp;
00FFFFFC&nbsp; 00000000</font>
<p>&nbsp;&nbsp; <font size=-1>In "C" file:</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp; register_test(0x4001000, 0xffffffff,
0, 0);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp; register_test(0x4080004,&nbsp; 3,
0x00fffffc, 0);</font>
<p><a NAME="SIM_TIME"></a><b>SIM_TIME</b>
<br>Macro: SIM_TIME(ns_pointer)
<br>Description:
<br>&nbsp;&nbsp;&nbsp; Store current simulator uptime(in ns) into ns_pointer
<br>Header file: bcp_util.h
<br>Parameters:
<br>&nbsp;&nbsp;&nbsp; ns_pointer : long long pointer
<br>Return: 0
<br>Examples:
<br>&nbsp;&nbsp;&nbsp;&nbsp; <i><font size=-1>/* delay 8000 ns */</font></i>
<br><font size=-1>&nbsp;&nbsp;&nbsp; long long st, end;</font>
<p><font size=-1>&nbsp;&nbsp;&nbsp; SIM_TIME(&amp;st);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp; while (1) {</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIM_TIME(&amp;end);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((end-st)
> 8000) break;</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BCP_STALL(1);</font>
<br><font size=-1>&nbsp;&nbsp;&nbsp; }</font>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
</body>
</html>