This zipfile contains the following files:
README :  this file, listing the contents of the archive and guidance on how to use them
work2 : directory containing the compiled library with the encrypted model of the 1 Gb Rad-Hard SONOS Flash
config.v : verilog include file with default clock frequency
params.v : verilog include file with parameter definitions for opcodes, mode definitions, timing parameters, data patterns, ID values, and serial flash discovery parameter comparison values
spi_driver.v : verilog include file with tasks and functions for transaction definitions
test_cases.v : verilog include file with the test sequence of transactions
tb_beh.v : verilog testbench instantiating the device under test
fm_main.rom : memory pre-load, all zeros with consistent ECC values
fm_sm_1.rom : partial supervisory memory image
fm_red_main.rom : array repair memory image
fm_sm.rom_fullTPP : partial supervisory memory image for cycle-accurate Page Programming times (32ms)
fm_sm.rom_TPPreduced : partial supervisory memory image for reduced Page Programming times (2ms) for faster simulation.

----------------------------------------------------------------------------------------------------------

This archive was tested to work with Questa Sim -64 2020.3_2, Revision: 2020.09, Date: Sep 23 2020
All the verilog files should reside in one directory, alongside the work2 directory.
For the remaining instructions $SIMDIR shall refer to that directory.

> cd $SIMDIR

There are two files, "fm_sm.rom_TPPreduced" and "fm_sm.rom_fullTPP". One of these needs to be copied to 
a file named "fm_sm.rom". Copy TPPreduced for a faster simulation with reduced page program times, or
copy fullTPP for cycle accurate page programs. For example:

> cp fm_sm.rom_TPPreduced fm_sm.rom

Then, the appropriate value for parameter "TPP" in params.v line 76 must be set. 2000000 if using 
TPPreduced, or 32000000 if using fullTPP.

Either from the command line or within the simulator, execute the following

> vlog -reportprogress 300 -work work $SIMDIR/tb_beh.v

This should compile the testbench into a new "work" library.

> vsim -i work.tb_beh {-voptargs=+acc -L work -L work2}

This will elaborate the testbench and instantiate the encrypted model

Within the simulation environment, add any desired testbench signals to the log for later viewing, e.g.:

> add wave -noupdate /tb_beh/rst_n
> add wave -noupdate /tb_beh/cs_n
> add wave -noupdate /tb_beh/si_io0
> add wave -noupdate /tb_beh/so_io1
> add wave -noupdate /tb_beh/wp_n_io2
> add wave -noupdate /tb_beh/io3
> add wave -noupdate /tb_beh/sclk_del

or

> add wave -noupdate /tb_beh/*

Run the test

> run -all

All "WARNING" messages and the following "Error" message may be safely ignored:
** Error: $setup
** Error: $width
** Error: $hold

The testbench generates "ERROR" messages (all caps) if anything goes wrong, so use case-sensitive
search to check for those.
