Skip to content

Display more helpful error message when parsing a BLIF file that cont… #340

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 2 commits into
base: master
Choose a base branch
from

Conversation

benreynwar
Copy link

…ains multi-driven nets. Fixes #330.

Description

When parsing a blif file into a netlist, a check is added to make sure that the blif file does not contain any multi-driven nets.

Related Issue

Fixes issue #330.

Motivation and Context

Gives user a more helpful error message.

How Has This Been Tested?

Confirmed that the example blif in issue #330 produces the new error message.
I have not added a regression test.

Types of changes

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
    This change should just modify the contents of the error message that the user receives.

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
    I ran the basic regression tests without failure. Strong are currently running.

@probot-autolabeler probot-autolabeler bot added lang-cpp C/C++ code VPR VPR FPGA Placement & Routing Tool labels May 6, 2018
Copy link
Contributor

@kmurray kmurray left a comment

Choose a reason for hiding this comment

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

Thanks for the patch!

The added check looks like it handles the case where a .names drives an already-driven net.

However to truly fix #330, it should also check anywhere else a net's driver is assigned. That would include: .inputs, .latchs and .subckts.

The same technique you used should be applicable. To avoid code duplication I'd suggest wrapping up the check in a re-useable function which can just be called from the input/latch/subckt/names creation functions.

@probot-autolabeler probot-autolabeler bot added lang-cpp C/C++ code VPR VPR FPGA Placement & Routing Tool labels May 8, 2018
@benreynwar
Copy link
Author

Made those fixes. Thanks for taking the time to double-check me!

@benreynwar
Copy link
Author

Are you adding regression tests to check error messages? If so, could you point me at an existing test and I'll base a test off it.

Copy link
Contributor

@kmurray kmurray left a comment

Choose a reason for hiding this comment

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

Overall this looks great!

Just a minor restructuring of the subckt check at it should be good to merge!

void assert_net_has_no_driver(std::string net_name) {
AtomNetId net_id = curr_model().create_net(net_name);
assert_net_has_no_driver(net_id, net_name);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably drop this overload if we restructure the subckt check slightly (see below).

subckt_name = nets[i];
subckt_name_set = true;
}
assert_net_has_no_driver(nets[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Likely best to move this check down to after we have the actual net_id from create_net(). We can still figure out if it's an output by looking at pin_type.

@kmurray
Copy link
Contributor

kmurray commented May 10, 2018

It would be great to add a regression test for this case. A short tutorial on adding tests is here: https://docs.verilogtorouting.org/en/latest/dev/developing/#adding-tests

Generally our tests have focused on verifying functionality on correct input. It would be good to start building up tests which checks error handling.

I think the test scripts should handle checking that the tool exits with an appropriate non-zero exit code (VPR should exit with 1 on an error like this). But if they don't we can merge this PR and address that separately.

@mithro
Copy link
Contributor

mithro commented Jun 3, 2021

Hi @benreynwar,

Any idea if this change is still relevant? It would be nice to rebase and merge it if it is?

Tim 'mithro' Ansell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-cpp C/C++ code VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve VPR error message when circuit contains multi-driven nets
4 participants