Natheir Abu-Dahab
4 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
14 additions and
8 deletions
-
fesvr/htif.cc
-
fesvr/memif.cc
-
riscv/bulknormdot.h
|
|
|
@ -277,8 +277,8 @@ void htif_t::clear_chunk(addr_t taddr, size_t len) |
|
|
|
{ |
|
|
|
std::vector<uint8_t> zeros(chunk_max_size(), 0); |
|
|
|
|
|
|
|
for (size_t pos = 0; pos < len; pos += chunk_max_size()) |
|
|
|
write_chunk(taddr + pos, std::min(len - pos, chunk_max_size()), &zeros[0]); |
|
|
|
for (size_t pos = 0; pos < len; pos += zeros.size()) |
|
|
|
write_chunk(taddr + pos, std::min(len - pos, zeros.size()), &zeros[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int htif_t::run() |
|
|
|
|
|
|
|
@ -35,8 +35,9 @@ void memif_t::read(addr_t addr, size_t len, void* bytes) |
|
|
|
} |
|
|
|
|
|
|
|
// now we're aligned
|
|
|
|
for (size_t pos = 0; pos < len; pos += cmemif->chunk_max_size()) |
|
|
|
cmemif->read_chunk(addr + pos, std::min(cmemif->chunk_max_size(), len - pos), (char*)bytes + pos); |
|
|
|
size_t max_chunk = cmemif->chunk_max_size(); |
|
|
|
for (size_t pos = 0; pos < len; pos += max_chunk) |
|
|
|
cmemif->read_chunk(addr + pos, std::min(max_chunk, len - pos), (char*)bytes + pos); |
|
|
|
} |
|
|
|
|
|
|
|
void memif_t::write(addr_t addr, size_t len, const void* bytes) |
|
|
|
|
|
|
|
@ -203,13 +203,18 @@ template<typename ValueTypeLHS, typename ValueTypeRHS, typename SigProdType> bul |
|
|
|
a[i].isZero() || b[i].isZero() ? (f32_exp_bias - (lhs_bias + rhs_bias)) : // minimalize exp of zero product
|
|
|
|
a[i].expSubFixed() + b[i].expSubFixed() + (f32_exp_bias - (lhs_bias + rhs_bias)); |
|
|
|
|
|
|
|
bool a_is_zero = (a[i].subOrZero() && cfg.flushSub) || a[i].isZero(); |
|
|
|
bool b_is_zero = (b[i].subOrZero() && cfg.flushSub) || b[i].isZero(); |
|
|
|
|
|
|
|
bool either_inf = a[i].inf() || b[i].inf(); |
|
|
|
any_pos_inf |= either_inf && a[i].sign() == b[i].sign(); |
|
|
|
any_neg_inf |= either_inf && a[i].sign() != b[i].sign(); |
|
|
|
bool either_nan = a[i].nan() || b[i].nan(); |
|
|
|
bool either_zero = a_is_zero || b_is_zero; |
|
|
|
any_pos_inf |= either_inf && !either_nan && !either_zero && a[i].sign() == b[i].sign(); |
|
|
|
any_neg_inf |= either_inf && !either_nan && !either_zero && a[i].sign() != b[i].sign(); |
|
|
|
|
|
|
|
any_invalid_nan |= |
|
|
|
(a[i].inf() && ((b[i].subOrZero() && cfg.flushSub) || b[i].isZero())) || |
|
|
|
(b[i].inf() && ((a[i].subOrZero() && cfg.flushSub) || a[i].isZero())); |
|
|
|
(a[i].inf() && b_is_zero) || |
|
|
|
(b[i].inf() && a_is_zero); |
|
|
|
|
|
|
|
any_nan |= any_invalid_nan || a[i].nan() || b[i].nan(); |
|
|
|
|
|
|
|
|