Pregunta

Estoy construyendo un modelo que me obliga a encontrar el máximo de un conjunto de 8 señales, también encontrar el índice del valor máximo.

¿Cómo puedo construir un modelo de este tipo en Simulink (biblioteca Xilinx)?

Estoy adivinando comparar el bloque seguido de un contador.Pero de alguna manera, no puedo imaginar todas las cosas juntas.

gracias

¿Fue útil?

Solución

One way which gets it all done in parallel:

You need to build a tree of comparators and multiplexers:

  • Start with a block which takes in two values and two indices and passes out the index and the value of the larger. One comparator, 2 muxes per block.
  • On the first level of your tree you have 4 of these blocks feeding into
    • a second level of 2 of these blocks, the results of which feed into
      • a final block which produces your answers

This can be pipelined so you can pour data through it as fast as you like. But it'll use a fair amount of resource. How wide are your signals? Each comparator is 1 LUT4 per bit and a 2:1 mux is 1 LUT4 per bit.

Alternatively, you use a counter to select each of your values in turn. If it's bigger than the current biggest, latch the value into your "biggest" register and latch the counter into a "biggest index" register. Reset the "biggest" register to the smallest value each time your counter resets.

This will take as many clock cycles as you have signal (8 in your case)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top