Skip to content

Commit

Permalink
Build and install Synopsys packages
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Mar 27, 2012
1 parent 6e42091 commit 6b949c5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Expand Up @@ -73,5 +73,6 @@ esac

AC_CONFIG_HEADERS([config.h])
AC_OUTPUT([Makefile src/Makefile src/rt/Makefile test/Makefile \
lib/Makefile lib/std/Makefile lib/ieee/Makefile])
lib/Makefile lib/std/Makefile lib/ieee/Makefile \
lib/synopsys/Makefile])

3 changes: 2 additions & 1 deletion lib/Makefile.am
@@ -1,7 +1,8 @@
SUBDIRS = std ieee
SUBDIRS = std ieee synopsys

bootstrap:
@cd std && $(MAKE) $(AM_MAKEFLAGS) bootstrap
@cd ieee && $(MAKE) $(AM_MAKEFLAGS) bootstrap
@cd synopsys && $(MAKE) $(AM_MAKEFLAGS) bootstrap

.PHONY: bootstrap
21 changes: 21 additions & 0 deletions lib/synopsys/Makefile.am
@@ -0,0 +1,21 @@
nvc = $(top_builddir)/src/nvc

# The Synopsys packages are not part of the IEEE standard but are
# traditionally compiled into the IEEE library
synopsysdir = $(pkgdatadir)/ieee
ieee = ../ieee/ieee
synopsys_DATA = $(ieee)/IEEE.STD_LOGIC_ARITH $(ieee)/IEEE.STD_LOGIC_ARITH-body \
$(ieee)/IEEE.STD_LOGIC_SIGNED $(ieee)/IEEE.STD_LOGIC_UNSIGNED

lib = NVC_LIBPATH=../std

bootstrap: $(synopsys_DATA)

$(ieee)/IEEE.STD_LOGIC_ARITH: $(srcdir)/std_logic_arith.vhd
$(lib) $(nvc) --work=$(ieee) -a $<

$(ieee)/IEEE.STD_LOGIC_UNSIGNED: $(srcdir)/std_logic_unsigned.vhd
$(lib) $(nvc) --work=$(ieee) -a $<

$(ieee)/IEEE.STD_LOGIC_SIGNED: $(srcdir)/std_logic_signed.vhd
$(lib) $(nvc) --work=$(ieee) -a $<
2 changes: 1 addition & 1 deletion src/cgen.c
Expand Up @@ -1093,7 +1093,7 @@ static LLVMValueRef cgen_ref(tree_t t, struct cgen_ctx *ctx)
case T_VAR_DECL:
{
LLVMValueRef ptr = cgen_get_var(decl, ctx);
if (type_kind(tree_type(decl)) == T_CARRAY)
if (type_is_array(tree_type(decl)))
return ptr;
else
return LLVMBuildLoad(builder, ptr, "");
Expand Down
13 changes: 12 additions & 1 deletion src/lib.c
Expand Up @@ -181,7 +181,16 @@ lib_t lib_find(const char *name, bool verbose, bool search)
const char *paths[MAX_SEARCH_PATHS];
size_t idx = 0;

push_path(paths, &idx, ".");
char *name_copy = strdup(name);
char *sep = strrchr(name_copy, '/');
if (sep == NULL)
push_path(paths, &idx, ".");
else {
// Work library contains path
*sep = '\0';
push_path(paths, &idx, name_copy);
name = sep + 1;
}

char *env_copy = NULL;
if (search) {
Expand All @@ -201,6 +210,7 @@ lib_t lib_find(const char *name, bool verbose, bool search)
lib_t lib;
for (const char **p = paths; *p != NULL; p++) {
if ((lib = lib_find_at(name, *p))) {
free(name_copy);
free(env_copy);
return lib;
}
Expand All @@ -213,6 +223,7 @@ lib_t lib_find(const char *name, bool verbose, bool search)
}
}

free(name_copy);
free(env_copy);
return NULL;
}
Expand Down

0 comments on commit 6b949c5

Please sign in to comment.