24.03.2013 Views

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

UM-366 14 - PSL Assertions<br />

Writing assertions in an external file<br />

Syntax<br />

Restrictions<br />

Example<br />

<strong>ModelSim</strong> <strong>SE</strong> User’s <strong>Manual</strong><br />

Assertions in an external file are grouped in vunits <strong>and</strong> bound to a module or<br />

entity/architecture.<br />

vunit name ([])<br />

{<br />

default clock = ;<br />

;<br />

...<br />

}<br />

name – The name of the vunit.<br />

– The hierarchical name of the module or entity/architecture to which<br />

the vunit is bound. If omitted, the vunit binds to the top-level design unit of the design under<br />

verification.<br />

– The default clock declaration for the vunit.<br />

– Any number of verification directives or PSL statements.<br />

The following restrictions exist when providing assertions in a separate file.<br />

Vunits can be bound only to a module, entity, or architecture.<br />

The PSL file <strong>and</strong> its corresponding HDL file must be compiled together.<br />

The following is an example using Verilog syntax that shows three assertions in one vunit.<br />

vunit check_dram_controller(dram_control)<br />

{<br />

default clock = rose(clk);<br />

// declare refresh sequence<br />

sequence refresh_sequence = {<br />

!cas_n && ras_n && we_n; [*1];<br />

(!cas_n && !ras_n && we_n)[*2];<br />

cas_n && ras_n};<br />

sequence signal_refresh = {[*24]; rose(refresh)};<br />

property refresh_rate = always {rose(reset_n) || rose(refresh)} |=><br />

{signal_refresh};<br />

assert refresh_rate;<br />

property check_refresh = always ({rose(refresh)} |-><br />

{(mem_state != IDLE)[*0:14]; (mem_state == IDLE); refresh_sequence}<br />

abort fell(reset_n));<br />

assert check_refresh;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!