+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Newbie level 3
    Points: 27, Level: 1

    Join Date
    Jul 2017
    Posts
    4
    Helped
    0 / 0
    Points
    27
    Level
    1

    Programmable Priority Encoder

    Can someone help me in designing a programmable priority encoder using verilog . A programmable priority encoder is a device where in addition to the the normal i/p and o/p's of a simple priority encoder there is one more input to decide which bit should have highest priority. Eg. for 4 : 2 programmable priority encoder..there would be 2 select input to decide the priority say [1:0]S.
    If S=00; I0 has highest priority..and the priority order will be I0>I3>I2>I1
    If S=01; I1 has highest priority..and the priority order will be I1>I0>I3>I2
    If S=10; I2 has highest priority..and the priority order will be I2>I1>I0>I3
    If S=11; I3 has highest priority..and the priority order will be I3>I2>I1>I0
    ..The solution is desired to be generic like the logic should remain same for 8:3 and 16:4 priority encoders as well...
    Any suggestions would be very helpful...Please help ASAP!!

    •   Alt13th July 2017, 17:00

      advertising

        
       

  2. #2
    Advanced Member level 5
    Points: 33,744, Level: 44
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,180
    Helped
    1808 / 1808
    Points
    33,744
    Level
    44

    Re: Programmable Priority Encoder

    So what have you done so far, and what are you having problems with?



  3. #3
    Newbie level 3
    Points: 27, Level: 1

    Join Date
    Jul 2017
    Posts
    4
    Helped
    0 / 0
    Points
    27
    Level
    1

    Re: Programmable Priority Encoder

    Well..my first approach was that to make a 8:3 programmable priority encoder I made eight regular priority encoders and one 8:1 mux . Each priority encoder has a fixed request order, and the multiplexer passes the desired code to the output. But its is not very efficient . I want a logic which is more efficient but nothing is striking my head.



    •   Alt14th July 2017, 09:59

      advertising

        
       

  4. #4
    Newbie level 3
    Points: 27, Level: 1

    Join Date
    Jul 2017
    Posts
    4
    Helped
    0 / 0
    Points
    27
    Level
    1

    Re: Programmable Priority Encoder

    Yeah but I wish to design such a logic in which when a 4:2 programmable priority encoder is converted to a 8:3 programmable priority encoder no major changes have to be made. If you seem to have any idea on how to do it please help me out.



  5. #5
    Super Moderator
    Points: 231,284, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    39,921
    Helped
    12195 / 12195
    Points
    231,284
    Level
    100

    Re: Programmable Priority Encoder

    But its is not very efficient.
    I doubt that it matters. You write a behavioral description of the logic function and the synthesis tool tries to minimize the logic.

    - - - Updated - - -

    I don't see a problem to write a parameterizable generic encoder description which works for N outputs and select inputs respectively 2^N request inputs.

    - - - Updated - - -

    Btw, the encoder should also have a specific output to "no request set", so you either need to reduce the number of request inputs to 2^N - 1, or use an additional encoder output.



  6. #6
    Newbie level 3
    Points: 27, Level: 1

    Join Date
    Jul 2017
    Posts
    4
    Helped
    0 / 0
    Points
    27
    Level
    1

    Re: Programmable Priority Encoder

    Are you really not getting what I wanna say..See I got a thing here...If we add a left rotator followed by a priority arbiter and then a right rotator followed by an encoder...This would act like a priority encoder..



  7. #7
    Advanced Member level 5
    Points: 33,744, Level: 44
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,180
    Helped
    1808 / 1808
    Points
    33,744
    Level
    44

    Re: Programmable Priority Encoder

    Its not clear what you really want help with, or what the problem really is.
    Have you written any code? have you compared different implementations?



    •   Alt16th July 2017, 19:35

      advertising

        
       

  8. #8
    Advanced Member level 2
    Points: 4,182, Level: 15

    Join Date
    Feb 2015
    Posts
    688
    Helped
    208 / 208
    Points
    4,182
    Level
    15

    Re: Programmable Priority Encoder

    A for-loop version probably works fine.

    if not, you can convert it into a rotate + priority encoder + adder, at least for the 2^N inputs case.

    There are a few other implementations possible. For example, you can create constants for 10101010, 11001100, 11110000 etc... based on elaboration time constants. Then you can use the "(-x) and (x)" trick to get a one-hot value. each bit of the encoder is then the or-reduction of "constant(n) and one_hot". That sounds interesting, but I'm not sure if it is actually better. The use of the addition should force the tools to use a different implementation method though.

    But I'd start by comparing the for-loop version to a more verbose fixed sized version. It doesn't take much time and allows you to determine if the for-loop approach happens to map better to a LUT based implementation.



--[[ ]]--