intX_fast_t may depend on compiler implementation and thus is not suited

for save states. (nw)
This commit is contained in:
couriersud 2017-01-05 18:11:37 +01:00
parent 47492e4821
commit 0ebd66d72f
5 changed files with 20 additions and 20 deletions

View File

@ -38,7 +38,7 @@ namespace netlist
logic_output_t m_DO; logic_output_t m_DO;
state_var<uint_fast8_t[128]> m_ram; // 1024x1 bits state_var<uint8_t[128]> m_ram; // 1024x1 bits
param_ptr_t m_RAM; param_ptr_t m_RAM;
}; };
@ -81,8 +81,8 @@ namespace netlist
if (!m_RWQ()) if (!m_RWQ())
{ {
m_ram[byte] &= ~(static_cast<uint_fast8_t>(1) << bit); m_ram[byte] &= ~(static_cast<uint8_t>(1) << bit);
m_ram[byte] |= (static_cast<uint_fast8_t>(m_DI()) << bit); m_ram[byte] |= (static_cast<uint8_t>(m_DI()) << bit);
} }
m_DO.push((m_ram[byte] >> bit) & 1, max_delay); m_DO.push((m_ram[byte] >> bit) & 1, max_delay);

View File

@ -37,7 +37,7 @@ namespace netlist
logic_input_t m_DIN; logic_input_t m_DIN;
logic_output_t m_DOUTQ; logic_output_t m_DOUTQ;
state_var<uint_fast64_t[4]> m_ram; // 256 bits state_var<uint64_t[4]> m_ram; // 256 bits
}; };
NETLIB_OBJECT_DERIVED(82S16_dip, 82S16) NETLIB_OBJECT_DERIVED(82S16_dip, 82S16)
@ -87,8 +87,8 @@ namespace netlist
if (!m_WEQ()) if (!m_WEQ())
{ {
m_ram[adr >> 6] = (m_ram[adr >> 6] m_ram[adr >> 6] = (m_ram[adr >> 6]
& ~(static_cast<uint_fast64_t>(1) << (adr & 0x3f))) & ~(static_cast<uint64_t>(1) << (adr & 0x3f)))
| (static_cast<uint_fast64_t>(m_DIN()) << (adr & 0x3f)); | (static_cast<uint64_t>(m_DIN()) << (adr & 0x3f));
} }
m_DOUTQ.push(((m_ram[adr >> 6] >> (adr & 0x3f)) & 1) ^ 1, NLTIME_FROM_NS(20)); m_DOUTQ.push(((m_ram[adr >> 6] >> (adr & 0x3f)) & 1) ^ 1, NLTIME_FROM_NS(20));
} }

View File

@ -27,7 +27,7 @@ namespace netlist
logic_input_t m_RC; logic_input_t m_RC;
logic_input_t m_IN; logic_input_t m_IN;
state_var<uint_fast16_t[5]> m_buffer; state_var<uint16_t[5]> m_buffer;
logic_output_t m_OUT; logic_output_t m_OUT;
}; };
@ -66,7 +66,7 @@ namespace netlist
NETLIB_SUB(Am2847_shifter) m_D; NETLIB_SUB(Am2847_shifter) m_D;
logic_input_t m_CP; logic_input_t m_CP;
state_var<uint_fast32_t> m_last_CP; state_var<uint32_t> m_last_CP;
}; };
NETLIB_OBJECT_DERIVED(AM2847_dip, AM2847) NETLIB_OBJECT_DERIVED(AM2847_dip, AM2847)
@ -111,10 +111,10 @@ namespace netlist
inline NETLIB_FUNC_VOID(Am2847_shifter, shift, (void)) inline NETLIB_FUNC_VOID(Am2847_shifter, shift, (void))
{ {
unsigned out = m_buffer[0] & 1; unsigned out = m_buffer[0] & 1;
uint_fast32_t in = (m_RC() ? out : m_IN()); uint32_t in = (m_RC() ? out : m_IN());
for (std::size_t i=0; i < 5; i++) for (std::size_t i=0; i < 5; i++)
{ {
uint_fast16_t shift_in = (i == 4) ? in : m_buffer[i + 1]; uint16_t shift_in = (i == 4) ? in : m_buffer[i + 1];
m_buffer[i] >>= 1; m_buffer[i] >>= 1;
m_buffer[i] |= shift_in << 15; m_buffer[i] |= shift_in << 15;
} }

View File

@ -355,15 +355,15 @@ namespace netlist
// State variables - predefined and c++11 non-optional // State variables - predefined and c++11 non-optional
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! predefined state variable type for uint_fast8_t */ /*! predefined state variable type for uint8_t */
using state_var_u8 = state_var<std::uint_fast8_t>; using state_var_u8 = state_var<std::uint8_t>;
/*! predefined state variable type for int_fast8_t */ /*! predefined state variable type for int8_t */
using state_var_s8 = state_var<std::int_fast8_t>; using state_var_s8 = state_var<std::int8_t>;
/*! predefined state variable type for uint_fast32_t */ /*! predefined state variable type for uint32_t */
using state_var_u32 = state_var<std::uint_fast32_t>; using state_var_u32 = state_var<std::uint32_t>;
/*! predefined state variable type for int_fast32_t */ /*! predefined state variable type for int32_t */
using state_var_s32 = state_var<std::int_fast32_t>; using state_var_s32 = state_var<std::int32_t>;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// object_t // object_t

View File

@ -33,7 +33,7 @@ namespace netlist
public: public:
using internal_type = TYPE; using internal_type = TYPE;
using mult_type = std::uint_fast64_t; using mult_type = std::uint64_t;
static constexpr internal_type resolution = RES; static constexpr internal_type resolution = RES;
constexpr ptime() noexcept : m_time(0) {} constexpr ptime() noexcept : m_time(0) {}
@ -127,7 +127,7 @@ namespace netlist
#if (PHAS_INT128) #if (PHAS_INT128)
using netlist_time = ptime<UINT128, NETLIST_INTERNAL_RES>; using netlist_time = ptime<UINT128, NETLIST_INTERNAL_RES>;
#else #else
using netlist_time = ptime<std::uint_fast64_t, NETLIST_INTERNAL_RES>; using netlist_time = ptime<std::uint64_t, NETLIST_INTERNAL_RES>;
#endif #endif
} }