Skip to content

Commit

Permalink
Apply editorial changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jserv committed Oct 26, 2023
1 parent 937feee commit 666b7eb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static uint32_t cache_size, cache_size_bits;
static struct mpool *cache_mp;

/* hash function for the cache */
HASH_FUNC_IMPL(cache_hash, cache_size_bits, cache_size);
HASH_FUNC_IMPL(cache_hash, cache_size_bits, cache_size)

#if RV32_HAS(ARC)
/* The Adaptive Replacement Cache (ARC) improves the traditional LRU strategy
Expand Down
2 changes: 1 addition & 1 deletion src/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void rv_debug(riscv_t *rv)
#endif /* RV32_HAS(GDBSTUB) */

/* hash function for the block map */
HASH_FUNC_IMPL(map_hash, BLOCK_MAP_CAPACITY_BITS, 1 << BLOCK_MAP_CAPACITY_BITS);
HASH_FUNC_IMPL(map_hash, BLOCK_MAP_CAPACITY_BITS, 1 << BLOCK_MAP_CAPACITY_BITS)

/* allocate a basic block */
static block_t *block_alloc(riscv_t *rv)
Expand Down
12 changes: 6 additions & 6 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ uint32_t memory_ifetch(uint32_t addr)
return *(type *) (data_memory_base + addr); \
}

MEM_READ_IMPL(w, uint32_t);
MEM_READ_IMPL(s, uint16_t);
MEM_READ_IMPL(b, uint8_t);
MEM_READ_IMPL(w, uint32_t)
MEM_READ_IMPL(s, uint16_t)
MEM_READ_IMPL(b, uint8_t)

#define MEM_WRITE_IMPL(size, type) \
void memory_write_##size(uint32_t addr, const uint8_t *src) \
{ \
*(type *) (data_memory_base + addr) = *(const type *) src; \
}

MEM_WRITE_IMPL(w, uint32_t);
MEM_WRITE_IMPL(s, uint16_t);
MEM_WRITE_IMPL(b, uint8_t);
MEM_WRITE_IMPL(w, uint32_t)
MEM_WRITE_IMPL(s, uint16_t)
MEM_WRITE_IMPL(b, uint8_t)
10 changes: 5 additions & 5 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ void rv_clock_gettime(struct timespec *tp);
* See
* https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/linux/hash.h
*/
#define HASH_FUNC_IMPL(name, size_bits, size) \
FORCE_INLINE uint32_t name(uint32_t val) \
{ \
/* 0x61C88647 is 32-bit golden ratio */ \
return (val * 0x61C88647 >> (32 - size_bits)) & ((size) -1); \
#define HASH_FUNC_IMPL(name, size_bits, size) \
FORCE_INLINE uint32_t name(uint32_t val) \
{ \
/* 0x61C88647 is 32-bit golden ratio */ \
return (val * 0x61C88647 >> (32 - size_bits)) & ((size) - (1)); \
}

1 comment on commit 666b7eb

@jserv
Copy link
Contributor Author

@jserv jserv commented on 666b7eb Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Benchmark suite Current: 666b7eb Previous: 0337caa Ratio
Dhrystone 1404.12 Average DMIPS over 10 runs 1237 Average DMIPS over 10 runs 0.88
Coremark 1164.239 Average iterations/sec over 10 runs 1056.257 Average iterations/sec over 10 runs 0.91

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.