From 2a0431bec0ecbeff833fa1f539249d7d175d86ee Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 10 Feb 2024 09:50:06 +0000 Subject: [PATCH] Use a flag bit on rt_signal_t to hold register/bus state --- src/lower.c | 4 ++-- src/rt/model.c | 2 +- src/rt/rt.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lower.c b/src/lower.c index b9251d3e..b0865efb 100644 --- a/src/lower.c +++ b/src/lower.c @@ -8009,7 +8009,7 @@ static void lower_signal_decl(lower_unit_t *lu, tree_t decl) sig_flags_t flags = 0; if (tree_flags(decl) & TREE_F_REGISTER) - flags |= NET_F_REGISTER; + flags |= SIG_F_REGISTER; lower_sub_signals(lu, type, type, value_type, decl, NULL, var, VCODE_INVALID_REG, init_reg, VCODE_INVALID_REG, @@ -11989,7 +11989,7 @@ static void lower_port_signal(lower_unit_t *lu, tree_t port, sig_flags_t flags = 0; if (tree_flags(port) & TREE_F_REGISTER) - flags |= NET_F_REGISTER; + flags |= SIG_F_REGISTER; // Port signals will need separate driving/effective values if they // are inout or have conversion functions. diff --git a/src/rt/model.c b/src/rt/model.c index d893337b..d70935b5 100644 --- a/src/rt/model.c +++ b/src/rt/model.c @@ -1948,7 +1948,7 @@ static void *driving_value(rt_nexus_t *nexus) // If S is of signal kind register and all the sources of S have // values determined by the null transaction, then the driving // value of S is unchanged from its previous value. - if (nonnull == 0 && (nexus->flags & NET_F_REGISTER)) + if (nonnull == 0 && (nexus->signal->shared.flags & SIG_F_REGISTER)) return nexus_effective(nexus); else if (nonnull == 0 && released == nexus->n_sources) return nexus_driving(nexus); diff --git a/src/rt/rt.h b/src/rt/rt.h index 27c482e0..c7fa1776 100644 --- a/src/rt/rt.h +++ b/src/rt/rt.h @@ -59,7 +59,7 @@ typedef enum { #define NET_F_CACHE_EVENT (1 << 2) #define NET_F_R_IDENT (1 << 3) // Unused (1 << 4) -#define NET_F_REGISTER (1 << 5) +// Unused (1 << 5) #define NET_F_FAST_DRIVER (1 << 6) #define NET_F_EFFECTIVE (1 << 7) typedef uint8_t net_flags_t; @@ -68,6 +68,7 @@ typedef uint8_t net_flags_t; #define SIG_F_STD_LOGIC (1 << 9) #define SIG_F_CACHE_EVENT (1 << 10) #define SIG_F_EVENT_FLAG (1 << 11) +#define SIG_F_REGISTER (1 << 12) typedef uint32_t sig_flags_t; typedef enum { -- 2.39.2