+ Post New Thread
Results 1 to 12 of 12
  1. #1
    Newbie level 4
    Points: 61, Level: 1

    Join Date
    Jul 2017
    Posts
    7
    Helped
    0 / 0
    Points
    61
    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!!

  2. #2
    Advanced Member level 5
    Points: 34,260, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,276
    Helped
    1832 / 1832
    Points
    34,260
    Level
    45

    Re: Programmable Priority Encoder

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



    •   Alt13th July 2017, 18:49

      advertising

        
       

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

    Join Date
    Jul 2017
    Posts
    7
    Helped
    0 / 0
    Points
    61
    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.



  4. #4
    Newbie level 4
    Points: 61, Level: 1

    Join Date
    Jul 2017
    Posts
    7
    Helped
    0 / 0
    Points
    61
    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: 233,774, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    40,388
    Helped
    12337 / 12337
    Points
    233,774
    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.



    •   Alt14th July 2017, 18:28

      advertising

        
       

  6. #6
    Newbie level 4
    Points: 61, Level: 1

    Join Date
    Jul 2017
    Posts
    7
    Helped
    0 / 0
    Points
    61
    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: 34,260, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,276
    Helped
    1832 / 1832
    Points
    34,260
    Level
    45

    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?



  8. #8
    Advanced Member level 3
    Points: 4,416, Level: 15

    Join Date
    Feb 2015
    Posts
    728
    Helped
    217 / 217
    Points
    4,416
    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.



    •   Alt17th July 2017, 00:51

      advertising

        
       

  9. #9
    Newbie level 4
    Points: 61, Level: 1

    Join Date
    Jul 2017
    Posts
    7
    Helped
    0 / 0
    Points
    61
    Level
    1

    Re: Programmable Priority Encoder

    Please elaborate the one hot method ...Are you talking about masking the input requests or something else..please elaborate it..



  10. #10
    Advanced Member level 3
    Points: 4,416, Level: 15

    Join Date
    Feb 2015
    Posts
    728
    Helped
    217 / 217
    Points
    4,416
    Level
    15

    Re: Programmable Priority Encoder

    The expression "(-x) and (x)" will result in either 0 (if the input is 0), or a vector in which the rightmost '1' is the only bit set. This is easy to show by doing each step of the computation.

    If the input has only a single 1, the priority encoder logic is much simpler and can be implemented by doing and-or logic with "10101010", "11001100", and "11110000" (for 8 inputs). This is the vector where the value is '1' for index 0, 1, and 2 respectively.

    This method is of interest only as the coding style is different, and it implements the inductive logic using a carry chain.



  11. #11
    Newbie level 4
    Points: 61, Level: 1

    Join Date
    Jul 2017
    Posts
    7
    Helped
    0 / 0
    Points
    61
    Level
    1

    Re: Programmable Priority Encoder

    Can you describe an hardware based design for a programmable priority encoder ..like through rotators encoders etc...



  12. #12
    Newbie level 4
    Points: 61, Level: 1

    Join Date
    Jul 2017
    Posts
    7
    Helped
    0 / 0
    Points
    61
    Level
    1

    [merged] Programmable Priority Encoder

    Help regarding structural modelling of a programmable priority encoder(ppe)...Where different blocks can be coded in behavioral model but overall ppe must be modeled in structural manner...



--[[ ]]--