Amiq is pleased to announce the release of the YAMM 2.0!
The highlight of this release is a C++ implementation that provides the same API as the SystemVerilog one.
Download
You can download the YAMM library from GitHub.
For getting up to speed you can read our previous post, download YAMM’s User Manual or browse the documentation.
The YAMM code is provided as an opensource library under Apache License 2.0.
Integrate YAMM with your C++ project
The first step towards using YAMM is including the yamm header:
#include "yamm.h" using namespace yamm_ns;
All the functions are grouped under the yamm_ns namespace.
To instantiate a memory map you must create an yamm object and then call the build method on it:
yamm my_new_memory;
my_new_memory.build(1024*1024*1024); // Creates a 1GByte free memory
Now you are all set to use it. For example:
yamm my_new_memory;
my_new_memory.build(1024*1024*1024); // Creates a 1GByte free memory
...
yamm_buffer* handle = my_new_memory.allocate_by_size(1024*1024, BEST_FIT); // 1MByte allocation
...
my_new_memory.deallocate(handle); // Deallocation
The API is presented in depth in the YAMM user guide available here.
Performance
We measured the performance by running the following scenario on a 1Gbyte memory:
- Allocate 5000 buffers of 65KBytes each in UNIFORM_FIT to fragment the memory
- Start allocating 95KBytes buffers. If there’s not enough space we half the size. This stops when we allocate 20000 buffers.
- Deallocate all the buffers
Here are the results for some allocation modes:
- RANDOM_FIT:
- Usage: 96.012%
- Time: 3.18 seconds
- FIRST_FIT:
- Usage: 99.922%
- Time: 0.47 seconds
- UNIFORM_FIT:
- Usage: 99.417%
- Time: 3.29 seconds
The release provides the performance test in case you want to run it.
SystemVerilog Updates
We also made a number of updates on the SystemVerilog version.
- Beautify code, refactor some of the API
- Ported all self-checking examples to UVM tests
- Refactored the insert to better support address alignment and size granularity
- Changed the sprint_buffer way of displaying to: @start_addr:@end_addr:size FREE/USED STATIC/NORMAL
- Fixed the get_buffers_in_range() function to return the last buffer in the memory
- Updated check_address_space_consistency() to catch any inconsistencies in recursive allocation
Roadmap
There are a couple of things left:
- Release the e-language version
- Implement access policies
We welcome any feedback!