Line 19... |
Line 19... |
/* You should have received a copy of the GNU Lesser General Public License */
|
/* You should have received a copy of the GNU Lesser General Public License */
|
/* along with this source; if not, write to the Free Software Foundation, */
|
/* along with this source; if not, write to the Free Software Foundation, */
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
/* */
|
/* */
|
/*===========================================================================*/
|
/*===========================================================================*/
|
/* SANDBOX */
|
/* COREMARK */
|
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
/* */
|
/* */
|
/* Author(s): */
|
/* Author(s): */
|
/* - Olivier Girard, olgirard@gmail.com */
|
/* - Olivier Girard, olgirard@gmail.com */
|
/* */
|
/* */
|
Line 53... |
Line 53... |
|
|
//---------------------------------------
|
//---------------------------------------
|
// Check CPU configuration
|
// Check CPU configuration
|
//---------------------------------------
|
//---------------------------------------
|
|
|
if ((`PMEM_SIZE !== 24576) || (`DMEM_SIZE !== 16384))
|
if ((`PMEM_SIZE !== 55296) || (`DMEM_SIZE !== 5120))
|
begin
|
begin
|
$display(" ===============================================");
|
$display(" ===============================================");
|
$display("| SIMULATION ERROR |");
|
$display("| SIMULATION ERROR |");
|
$display("| |");
|
$display("| |");
|
$display("| Core must be configured for: |");
|
$display("| Core must be configured for: |");
|
$display("| - 24kB program memory |");
|
$display("| - 54kB program memory |");
|
$display("| - 16kB data memory |");
|
$display("| - 5kB data memory |");
|
$display(" ===============================================");
|
$display(" ===============================================");
|
$finish;
|
$finish;
|
end
|
end
|
|
|
|
// Disable watchdog
|
|
// (only required because RedHat/TI GCC toolchain doesn't disable watchdog properly at startup)
|
|
`ifdef WATCHDOG
|
|
force dut.watchdog_0.wdtcnt = 16'h0000;
|
|
`endif
|
|
|
//---------------------------------------
|
//---------------------------------------
|
// Number of benchmark iteration
|
// Number of benchmark iteration
|
// (Must match the C-code value)
|
// (Must match the C-code value)
|
//---------------------------------------
|
//---------------------------------------
|
|
|
Line 88... |
Line 94... |
mclk_period = mclk_end_time-mclk_start_time;
|
mclk_period = mclk_end_time-mclk_start_time;
|
mclk_frequency = 1000/mclk_period;
|
mclk_frequency = 1000/mclk_period;
|
$display("\nINFO-VERILOG: openMSP430 System clock frequency %f MHz", mclk_frequency);
|
$display("\nINFO-VERILOG: openMSP430 System clock frequency %f MHz", mclk_frequency);
|
|
|
//---------------------------------------
|
//---------------------------------------
|
// Measure Dhrystone run time
|
// Measure CoreMark run time
|
//---------------------------------------
|
//---------------------------------------
|
|
|
// Detect beginning of run
|
// Detect beginning of run
|
@(posedge p2_dout[1]);
|
@(posedge p2_dout[1]);
|
coremark_start_time = $time;
|
coremark_start_time = $time;
|
$timeformat(-3, 3, " ms", 10);
|
$timeformat(-3, 3, " ms", 10);
|
$display("INFO-VERILOG: CoreMark loop started at %t ", coremark_start_time);
|
$display("INFO-VERILOG: CoreMark loop started at %t ", coremark_start_time);
|
|
$display("");
|
|
$display("INFO-VERILOG: Be patient... there could be up to 90ms to simulate");
|
|
$display("");
|
|
|
// Detect end of run
|
// Detect end of run
|
@(negedge p2_dout[1]);
|
@(negedge p2_dout[1]);
|
coremark_end_time = $time;
|
coremark_end_time = $time;
|
$timeformat(-3, 3, " ms", 10);
|
$timeformat(-3, 3, " ms", 10);
|
Line 134... |
Line 143... |
|
|
// Display stuff from the C-program
|
// Display stuff from the C-program
|
always @(p2_dout[0])
|
always @(p2_dout[0])
|
begin
|
begin
|
$write("%s", p1_dout);
|
$write("%s", p1_dout);
|
|
$fflush();
|
|
end
|
|
|
|
// Display some info to show simulation progress
|
|
initial
|
|
begin
|
|
@(posedge p2_dout[1]);
|
|
#1000000;
|
|
while (p2_dout[1])
|
|
begin
|
|
$display("INFO-VERILOG: Simulated time %t ", $time);
|
|
#1000000;
|
|
end
|
end
|
end
|
|
|
|
|
// Time tick counter
|
// Time tick counter
|
always @(negedge mclk or posedge puc_rst)
|
always @(negedge mclk or posedge puc_rst)
|