Skip to content

LUT element support #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: fpga-interchange-baseline
Choose a base branch
from
Open

Conversation

mkurc-ant
Copy link

@mkurc-ant mkurc-ant commented Dec 8, 2021

This PR adds support for LUT elements.

A LUT element is modeled as a pb_type with one mode per each LUT BEL from the element. This is suboptimal as it doesn't allow to pack eg. two smaller LUTs together into a fractuable LUT element but it is ok as a starting point for future improvements.

Each individual LUT (inside its mode) has two modes: one for a LUT-thru and another for the actual LUT bel.

@mkurc-ant mkurc-ant requested review from acomodi and mtdudek December 8, 2021 14:00
@mkurc-ant mkurc-ant force-pushed the mkurc/luts branch 2 times, most recently from d80af6c to b01b7a1 Compare December 8, 2021 14:40
@mkurc-ant mkurc-ant changed the title [WIP] LUT element support LUT element support Dec 15, 2021
@github-actions github-actions bot added the VPR label Dec 15, 2021
Signed-off-by: Maciej Kurc <[email protected]>
Copy link

@acomodi acomodi left a comment

Choose a reason for hiding this comment

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

LGTM apart one small comment

Comment on lines +53 to +83
namespace vtr {
static char* stringf(const char* format, ...) {
// Initial buffer
const int initialSize = 80 + 1;
char* str = (char*)vtr::malloc(initialSize);

// Init and copy args list
va_list va1, va2;
va_start(va1, format);
va_copy(va2, va1);

// First attempt
int len = vsnprintf(str, initialSize, format, va1);
VTR_ASSERT(len >= 0);

// The buffer was too small
if (len >= initialSize) {
str = (char*)vtr::realloc((void*)str, len + 1);
VTR_ASSERT(str != nullptr);
len = vsnprintf(str, len + 1, format, va2);
VTR_ASSERT(len >= 0);
VTR_ASSERT(len <= len);
}

// Cleanup
va_end(va1);
va_end(va2);

return str;
}
} // namespace vtr
Copy link

Choose a reason for hiding this comment

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

I believe this should end up in libvtrutils (or sth similar)

@acomodi
Copy link

acomodi commented Dec 21, 2021

I have added the changes from this PR to the one open upstream: verilog-to-routing#1937.

I have adapted the changes to solve some issues with xc7 and nexus devices, for instance the fact that the LUT bels of the "memory" type SLICEs can have other BEL pins, not taken into account in the LutDefinitions. This is a TODO for the future, to enable LUTs in memory mode, for instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants