Skip to content

[bitmanip] Remove redundant logic #2296

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

Conversation

ESE-2019
Copy link

Remove the redundant logic & ~bitcnt_mask_op, as explained in issue #2294 .

    always_comb begin
      unique case (1'b1)
        zbe_op:      bitcnt_bits = operand_b_i;
        // bitcnt_cz:   bitcnt_bits = bitcnt_bit_mask & ~bitcnt_mask_op; // clz / ctz
        bitcnt_cz:   bitcnt_bits = bitcnt_bit_mask; // clz / ctz
        default:     bitcnt_bits = operand_a_i; // cpop
      endcase
    end

@rswarbrick
Copy link
Contributor

I think this is a sensible change, thanks. Would you mind expanding the commit message to explain what's going on? It's always easier to understand the history of the repository if it's not dependant on GitHub. With my "maths hat on", I'm always enthusiastic about giving a minimal "proof" of why a commit is the right thing to do.

Working out how to write such a commit message sometimes makes me adjust the code as well, which I think is probably a good thing. I'd also be tempted to extend this commit slightly to get rid of the slightly silly loops for replicating the bit. Is that easy? (And does it work? I only suggested this from reading the existing code...)

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

Successfully merging this pull request may close these issues.

2 participants