From 05a10084c8b1006fc7f7c1b5d92defecc9d98627 Mon Sep 17 00:00:00 2001 From: Rajit Manohar Date: Wed, 22 Feb 2023 13:18:52 -0500 Subject: [PATCH] skip negatives --- chpsim.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chpsim.cc b/chpsim.cc index 7e2c358..949f237 100644 --- a/chpsim.cc +++ b/chpsim.cc @@ -301,6 +301,9 @@ static void _get_costs (stateinfo_t *si, ActId *id, chpsimstmt *stmt) if (config_exists (buf)) { if (debug_metrics) fprintf (stderr, " >> found %s\n", buf); stmt->delay_cost = config_get_int (buf); + if (stmt->delay_cost < 0) { + stmt->delay_cost = 0; + } } else { // default delay is 10 @@ -320,6 +323,9 @@ static void _get_costs (stateinfo_t *si, ActId *id, chpsimstmt *stmt) if (config_exists (buf)) { if (debug_metrics) fprintf (stderr, " >> found %s\n", buf); stmt->energy_cost = config_get_int (buf); + if (stmt->energy_cost < 0) { + stmt->energy_cost = 0; + } } else { // default energy is 0