Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: 1fa7ac6ca7
...
compare: 1a6b149f08
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 20, 2012
@nickg Nested signal array references 5b87697
Commits on Jun 01, 2012
@nickg Add signal8 test 1a6b149
Showing with 38 additions and 12 deletions.
  1. +16 −12 src/cgen.c
  2. +22 −0 test/regress/signal8.vhd
View
28 src/cgen.c
@@ -1771,24 +1771,28 @@ static LLVMValueRef cgen_signal_lvalue(tree_t t, cgen_ctx_t ctx)
{
switch (tree_kind(t)) {
case T_REF:
- {
- tree_t decl = tree_ref(t);
- return cgen_array_signal_ptr(decl, llvm_int32(0));
- }
- break;
+ return cgen_array_signal_ptr(tree_ref(t), llvm_int32(0));
case T_ARRAY_REF:
{
- assert(tree_kind(tree_value(t)) == T_REF);
-
- tree_t decl = tree_ref(tree_value(t));
- assert(type_is_array(tree_type(decl)));
-
param_t p = tree_param(t, 0);
assert(p.kind == P_POS);
LLVMValueRef elem = cgen_expr(p.value, ctx);
- return cgen_array_signal_ptr(decl, elem);
+
+ if (tree_kind(tree_value(t)) == T_REF) {
+ tree_t decl = tree_ref(tree_value(t));
+ assert(type_is_array(tree_type(decl)));
+
+ return cgen_array_signal_ptr(decl, elem);
+ }
+ else {
+ LLVMValueRef p_base = cgen_signal_lvalue(tree_value(t), ctx);
+
+ LLVMValueRef indexes[] = { llvm_int32(0), elem };
+ return LLVMBuildGEP(builder, p_base,
+ indexes, ARRAY_LEN(indexes), "foo");
+ }
}
break;
@@ -2217,7 +2221,7 @@ static void cgen_driver_init_fn(tree_t t, void *arg)
LLVMValueRef val = cgen_expr(tree_value(decl), ctx);
type_t type = tree_type(decl);
- if (type_kind(type) == T_CARRAY) {
+ if (type_is_array(type)) {
// Initialise only those sub-elements for which this
// process is a driver
View
22 test/regress/signal8.vhd
@@ -0,0 +1,22 @@
+entity signal8 is
+end entity;
+
+architecture test of signal8 is
+ type int_array is array (integer range <>) of integer;
+ type int_array_Nx4 is array (integer range <>) of int_array(1 to 4);
+
+ signal a : int_array_Nx4(1 to 4);
+ signal b : int_array(1 to 4);
+begin
+
+ process is
+ begin
+ a(1)(2) <= 2;
+ --assert a(1)(2) = 2;
+-- a := ( others => ( 1, 2, 3, 4 ) );
+-- b := a(1);
+-- assert b = ( 1, 2, 3, 4);
+ wait;
+ end process;
+
+end architecture;

No commit comments for this range

Something went wrong with that request. Please try again.