Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 124867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:04:06+00:00 2026-05-11T05:04:06+00:00

I posted this digital logic diagram as an answer to another stackoverflow question .

  • 0

I posted this digital logic diagram as an answer to another stackoverflow question. It describes a logic system which will be coded in Verilog or VHDL and eventually implemented in an FPGA.

alt text http://img145.imageshack.us/img145/5125/bitshifterlogicdiagramkn7.jpg

The numbered boxes in the diagram represent bits in a field. Each field has K bits, and the bits for current and mask will be provided by a computer system (using a latched register or equivalent). The bits in next will be read back into that same computer system.

The solution that I posted works as long as there is at least one bit set in the mask field, and there is exactly one bit set in the current bit field. The idea is that the next bit field will become the current bit field after the computer system has performed some task (a scheduling operation, in the original question).

So, my question is this: How would you modify this system so that it properly handles the special case where the current bit field is all zero (no bits set)? As it stands, if all bits in current are zero, the output will also be zero, no matter what the bits in mask are set to.

Ideally, if current is all zeroes, the lowest set bit in mask should be set in next. The system should also still remain scalable to any number of bits (K) without having to add exponentially more logic gates. The spirit of the original question was to come up with a solution that would be straightforward to implement for any number of bits.

See also: this stackoverflow question

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:04:07+00:00Added an answer on May 11, 2026 at 5:04 am

    For me, I would tell the user of the FPGA that they must have one of the bits set to 1 on entry.

    However, if that’s not your preferred solution, what’s wrong with the idea of pre-feeding all the Current inputs initially into a big NOR gate (so that the output is true only when all inputs are false). All Current lines also continue through to their AND gates with the exception that Current[1] is OR’ed with the output of our NOR gate before entering it’s AND gate

    That way, Current[1] would be true entering the AND gate, if all Currents are false.

    Keep in mind that I understand boolean algebra but I’ve never worked on raw hardware – I’m guessing you’ll need to buffer all the input signals into the AND gates to ensure correct timing but i suspect you’ll know that better than I.

    The following diagram is left in in case SO fixes its code/pre blocks – the latest SO update seems to have stuffed them up (leaving them proportional, not fixed-width, font). Anyway, eJames’ graphical diagram is better.

    Here’s my diagram, slightly less elegant than yours :-):

                    +-------------------+                |                   |                |     +----         | Current[1]-----+------\   \        |                        |NOR|o--+   | Current[2-k]---+------/   /    |   |                |     +----     |   |                |              +\   /+                |              | \_/ |              +---+            |  OR |               \ /Buffer        \   /                +                ---                |                 |              +---+             +---+              |2-k|             | 1 |    <- These signals feed               +---+             +---+       into your AND gates. 

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 228k
  • Answers 228k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I found an excellent video on installing Drupal on your… May 13, 2026 at 1:33 am
  • Editorial Team
    Editorial Team added an answer My preferred way of handling nulls in a reader is… May 13, 2026 at 1:33 am
  • Editorial Team
    Editorial Team added an answer The best option is to use Windows Embedded. This gives… May 13, 2026 at 1:33 am

Related Questions

I posted an answer to another stackoverflow question which requires some digital logic to
I've actually posted this question before, but it hasn't been answered. Maybe I wasn't
I'm re-designing an app I inherited that sends digital photos from a laptop to
I'm having trouble compiling the example program presented in section 5.11 of the book.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.