Skip to content

ODIN II: add support for .vh files #906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ODIN_II/SRC/enum_str.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

const char *file_extension_supported_STR[] =
{
".v"
".v",
".vh"
};

const char *edge_type_e_STR[] =
Expand Down
1 change: 1 addition & 0 deletions ODIN_II/SRC/include/odin_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ extern const char *ids_STR [];
enum file_extension_supported
{
VERILOG,
VERILOG_HEADER,
file_extension_supported_END
};

Expand Down
1 change: 1 addition & 0 deletions ODIN_II/SRC/include/odin_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ long shift_left_value_with_overflow_check(long input_value, long shift_by);

std::string get_file_extension(std::string input_file);
void create_directory(std::string path);
void assert_supported_file_extension(std::string input_file, int file_number);

const char *name_based_on_op(operation_list op);
const char *name_based_on_ids(ids op);
Expand Down
27 changes: 27 additions & 0 deletions ODIN_II/SRC/odin_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,33 @@ void create_directory(std::string path)
}
}

void assert_supported_file_extension(std::string input_file, int file_number)
{
bool supported = false;
std::string extension = get_file_extension(input_file);
for(int i = 0; i< file_extension_supported_END && ! supported; i++)
{
supported = (extension == std::string(file_extension_supported_STR[i]) );
}

if(! supported)
{
std::string supported_extension_list = "";
for(int i=0; i<file_extension_supported_END; i++)
{
supported_extension_list += " ";
supported_extension_list += file_extension_supported_STR[i];
}

error_message(ARG_ERROR, -1, file_number,
"File (%s) has an unsupported extension (%s), Odin only support { %s }",
input_file.c_str(),
extension.c_str(),
supported_extension_list.c_str()
);
}
}

/*---------------------------------------------------------------------------------------------
* (function: name_based_on_op)
* Get the string version of an operation
Expand Down
34 changes: 0 additions & 34 deletions ODIN_II/SRC/parse_making_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,34 +78,6 @@ short to_view_parse;
ast_node_t *newFunctionAssigning(ast_node_t *expression1, ast_node_t *expression2, int line_number);
ast_node_t *resolve_ports(ids top_type, ast_node_t *symbol_list);


static void assert_supported_file_extension(std::string input_file, int file_number)
{
bool supported = false;
std::string extension = get_file_extension(input_file);
for(int i = 0; i< file_extension_supported_END && ! supported; i++)
{
supported = (extension == std::string(file_extension_supported_STR[i]) );
}

if(! supported)
{
std::string supported_extension_list = "";
for(int i=0; i<file_extension_supported_END; i++)
{
supported_extension_list += " ";
supported_extension_list += file_extension_supported_STR[i];
}

error_message(ARG_ERROR, -1, file_number,
"File (%s) has an unsupported extension (%s), Odin only support { %s }",
input_file.c_str(),
extension.c_str(),
supported_extension_list.c_str()
);
}
}

/*---------------------------------------------------------------------------------------------
* (function: parse_to_ast)
*-------------------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -808,12 +780,6 @@ ast_node_t *markAndProcessSymbolListWith(ids top_type, ids id, ast_node_t *symbo
symbol_list->children[i] = markAndProcessPortWith(top_type, id, NO_ID, symbol_list->children[i], is_signed);
break;
case WIRE:
if ((symbol_list->children[i]->num_children == 6 && symbol_list->children[i]->children[5] != NULL)
|| (symbol_list->children[i]->num_children == 8 && symbol_list->children[i]->children[7] != NULL))
{
error_message(NETLIST_ERROR, symbol_list->children[i]->line_number, symbol_list->children[i]->file_number, "%s",
"Nets cannot be initialized\n");
}
if (is_signed)
{
/* cannot support signed nets right now */
Expand Down
1 change: 1 addition & 0 deletions ODIN_II/SRC/verilog_preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ void veri_preproc_bootstraped(FILE *original_source, FILE *preproc_producer, ver
}
else if (NULL != (new_include = add_veri_include(file_path.c_str(), line_number, current_include)))
{
assert_supported_file_extension(file_path, -1);
printf("Including file %s\n", new_include->path);
veri_preproc_bootstraped(included_file, preproc_producer, new_include);
}
Expand Down