Skip to content

Commit

Permalink
Make t_item_range_value a signed 64-bit value. Fixes #1153
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Feb 6, 2025
1 parent 63c6af5 commit d06d576
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/nvc/cover_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package cover_pkg is

type t_item_handle is range -1 to 2147483647;

type t_item_range_value is range 0 to 2147483647;
type t_item_range_value is range -9223372036854775807 - 1 to 9223372036854775807;

type t_item_range is record
min : t_item_range_value;
Expand Down
4 changes: 2 additions & 2 deletions src/cov/cov-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ typedef enum {
} cover_src_t;

typedef struct {
uint32_t min;
uint32_t max;
int64_t min;
int64_t max;
} cover_range_t;

typedef struct _cover_item {
Expand Down
6 changes: 4 additions & 2 deletions src/cov/cov-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <stdlib.h>
#include <time.h>
#include <libgen.h>
#include <inttypes.h>

#define MARGIN_LEFT "20%%"
#define SIDEBAR_WIDTH "15%%"
Expand Down Expand Up @@ -726,9 +727,10 @@ static void cover_print_bins(FILE *f, cover_pair_t *first_pair, cov_pair_kind_t
const char *v[item->n_ranges] LOCAL;
for (int i = 0; i < item->n_ranges; i++)
if (item->ranges[i].min == item->ranges[i].max)
v[i] = xasprintf("%d", item->ranges[i].min);
v[i] = xasprintf("%"PRIi64, item->ranges[i].min);
else
v[i] = xasprintf("%d - %d", item->ranges[i].min, item->ranges[i].max);
v[i] = xasprintf("%"PRIi64" - %"PRIi64, item->ranges[i].min,
item->ranges[i].max);

cover_print_bin(f, pair, COV_FLAG_USER_DEFINED, pkind, item->n_ranges, v);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/rt/cover.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ void _nvc_add_cover_item(jit_scalar_t *args)
item->n_ranges = ffi_array_length(args[10].integer);
item->ranges = xcalloc_array(item->n_ranges, sizeof(cover_range_t));

int32_t *ptr = (int32_t *)args[8].pointer;
int64_t *ptr = (int64_t *)args[8].pointer;

for (int i = 0; i < item->n_ranges; i++) {
item->ranges[i].min = *ptr++;
Expand Down

0 comments on commit d06d576

Please sign in to comment.