Question

Je construis un modèle qui me demande de trouver le maximum d'un ensemble de 8 signaux, trouvez également l'index de la valeur maximale.

Comment puis-je construire un tel modèle dans Simulink (Bibliothèque Xilinx)?

Je suppose que le bloc comparez le bloc suiveur d'un comptoir.Mais d'une manière ou d'une autre, je ne suis pas capable de comprendre toutes choses ensemble.

merci

Était-ce utile?

La solution

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)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top