Skip to content

Commit

Permalink
WIP: SDF Tests debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrej.ille authored and Ondrej Ille committed Aug 25, 2024
1 parent bb059fa commit ff2a2e5
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 99 deletions.
3 changes: 2 additions & 1 deletion src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,7 @@ void analyse_file(const char *file, jit_t *jit, unit_registry_t *ur)
}
}
}
break;

case SOURCE_SDF:
{
Expand All @@ -2505,9 +2506,9 @@ sdf_file_t* analyse_sdf_file(const char *file)
// TODO: Add support for compressed SDFs

input_from_file(file);
reset_sdf_parser();

#ifdef ENABLE_SDF
reset_sdf_parser();
return sdf_parse();
#else
fatal("SDF not supported!");
Expand Down
11 changes: 10 additions & 1 deletion src/nvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ static int elaborate(int argc, char **argv, cmd_state_t *state)
{ "dump-vcode", optional_argument, 0, 'v' },
{ "cover", optional_argument, 0, 'c' },
{ "cover-spec", required_argument, 0, 's' },
#ifdef ENABLE_SDF
{ "sdf", required_argument, 0, 'f' },
#endif
{ "verbose", no_argument, 0, 'V' },
{ "no-save", no_argument, 0, 'N' },
{ "jit", no_argument, 0, 'j' },
Expand All @@ -374,7 +376,10 @@ static int elaborate(int argc, char **argv, cmd_state_t *state)

bool use_jit = DEFAULT_JIT, no_save = false;
cover_mask_t cover_mask = 0;
char *cover_spec_file, *sdf_args = NULL;
char *cover_spec_file = NULL;
#ifdef ENABLE_SDF
char *sdf_args = NULL;
#endif
int cover_array_limit = 0;
const int next_cmd = scan_cmd(2, argc, argv);
int c, index = 0;
Expand Down Expand Up @@ -415,9 +420,11 @@ static int elaborate(int argc, char **argv, cmd_state_t *state)
case 's':
cover_spec_file = optarg;
break;
#ifdef ENABLE_SDF
case 'f':
sdf_args = optarg;
break;
#endif
case 0:
// Set a flag
break;
Expand Down Expand Up @@ -451,10 +458,12 @@ static int elaborate(int argc, char **argv, cmd_state_t *state)
cover_load_spec_file(cover, cover_spec_file);
}

#ifdef ENABLE_SDF
if (sdf_args != NULL) {
analyse_sdf_file(sdf_args);
progress("analysed SDF file: %s", sdf_args);
}
#endif

if (state->registry != NULL) {
unit_registry_free(state->registry);
Expand Down
2 changes: 2 additions & 0 deletions src/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ void input_from_buffer(const char *buf, size_t len, hdl_kind_t kind)
reset_vhdl_parser();
break;
case SOURCE_SDF:
#ifdef ENABLE_SDF
reset_sdf_parser();
#endif
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sdf/sdf-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void sdf_dump_header_item(sdf_node_t s, int indent)

unsigned int sub = sdf_subkind(s);
switch (sub) {
case S_HEADER_SDF_VESION:
case S_HEADER_SDF_VERSION:
print_syntax("(#SDFVERSION ");
break;
case S_HEADER_DESIGN:
Expand Down
3 changes: 1 addition & 2 deletions src/sdf/sdf-node.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ sdf_node_t sdf_label(sdf_node_t s, unsigned int n)
void sdf_add_dim(sdf_node_t s, sdf_node_t dim)
{
assert(sdf_kind(s) == S_PORT);
assert(sdf_kind(dim) == S_DIMENSION);

sdf_array_add(lookup_item(&sdf_object, s, I_DIMS), dim);
object_write_barrier(&(s->object), &(dim->object));
Expand Down Expand Up @@ -552,7 +551,7 @@ sdf_node_t sdf_timing_env(sdf_node_t s, unsigned int n)
void sdf_set_exception(sdf_node_t s, sdf_node_t e)
{
assert(sdf_kind(s) == S_CONSTRAINT);
assert(sdf_kind(c) == S_EXCEPTION);
assert(sdf_kind(e) == S_EXCEPTION);

lookup_item(&sdf_object, s, I_CONTEXT)->object = &(e->object);
object_write_barrier(&(s->object), &(e->object));
Expand Down
3 changes: 2 additions & 1 deletion src/sdf/sdf-node.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "common.h"

typedef enum {
S_HEADER_SDF_VESION = (1 << 0),
S_HEADER_SDF_VERSION = (1 << 0),
S_HEADER_DESIGN = (1 << 1),
S_HEADER_DATE = (1 << 2),
S_HEADER_VENDOR = (1 << 3),
Expand Down Expand Up @@ -176,6 +176,7 @@ struct _sdf_file {

// Hierarchy separator
char hchar;
char hchar_other;

// Hierarchy -> Node list map
shash_t *hmap;
Expand Down
Loading

0 comments on commit ff2a2e5

Please sign in to comment.