NewANADOLOGIC Hardware Academy is live: 240 free, AI-graded FPGA & SoC questions.Start learning

FPGA & VHDL KnowHow Series1 min read

Circuit Anadologic

๐๐ฎ๐ž๐ฌ๐ญ๐ข๐จ๐ง: What happens if you assign multiple times the same value concurrently to a signal in ๐•๐‡๐ƒ๐‹?

๐€๐ง๐ฌ๐ฐ๐ž๐ซ: If you assign two or more different values to a signal concurrently in VHDL this is called as โ€œmulti-driven netโ€ such as:

๐‘’_๐‘œ <= ๐‘ ๐‘ก๐‘‘_๐‘™๐‘œ๐‘”๐‘–๐‘_๐‘ฃ๐‘’๐‘๐‘ก๐‘œ๐‘Ÿ(๐‘ข๐‘›๐‘ ๐‘–๐‘”๐‘›๐‘’๐‘‘(๐‘Ž_๐‘–) + ๐‘ข๐‘›๐‘ ๐‘–๐‘”๐‘›๐‘’๐‘‘(๐‘_๐‘–)); ๐‘’_๐‘œ <= ๐‘ ๐‘ก๐‘‘_๐‘™๐‘œ๐‘”๐‘–๐‘_๐‘ฃ๐‘’๐‘๐‘ก๐‘œ๐‘Ÿ(๐‘ข๐‘›๐‘ ๐‘–๐‘”๐‘›๐‘’๐‘‘(๐‘Ž_๐‘–) โ€“ ๐‘ข๐‘›๐‘ ๐‘–๐‘”๐‘›๐‘’๐‘‘(๐‘_๐‘–));

This is not allowed and you will get this critical warning from Vivado:

[๐‘†๐‘ฆ๐‘›๐‘กโ„Ž 8-6859] ๐‘š๐‘ข๐‘™๐‘ก๐‘–-๐‘‘๐‘Ÿ๐‘–๐‘ฃ๐‘’๐‘› ๐‘›๐‘’๐‘ก ๐‘œ๐‘› ๐‘๐‘–๐‘› ๐‘๐‘™๐‘Ž๐‘๐‘™๐‘Ž ๐‘ค๐‘–๐‘กโ„Ž 1๐‘ ๐‘ก ๐‘‘๐‘Ÿ๐‘–๐‘ฃ๐‘’๐‘Ÿ ๐‘๐‘–๐‘› โ€˜๐‘๐‘™๐‘Ž๐‘๐‘™๐‘Ž_๐‘“๐‘–๐‘Ÿ๐‘ ๐‘กโ€™ ๐‘Ž๐‘›๐‘‘ 2๐‘›๐‘‘ ๐‘‘๐‘Ÿ๐‘–๐‘ฃ๐‘’๐‘Ÿ ๐‘๐‘–๐‘› โ€˜๐‘๐‘™๐‘Ž๐‘๐‘™๐‘Ž_๐‘ ๐‘’๐‘๐‘œ๐‘›๐‘‘โ€™

But if you assign the same value to a signal concurrently multiple time such as:

๐‘’_๐‘œ <= ๐‘ ๐‘ก๐‘‘_๐‘™๐‘œ๐‘”๐‘–๐‘_๐‘ฃ๐‘’๐‘๐‘ก๐‘œ๐‘Ÿ(๐‘ข๐‘›๐‘ ๐‘–๐‘”๐‘›๐‘’๐‘‘(๐‘Ž_๐‘–) + ๐‘ข๐‘›๐‘ ๐‘–๐‘”๐‘›๐‘’๐‘‘(๐‘_๐‘–)); ๐‘’_๐‘œ <= ๐‘ ๐‘ก๐‘‘_๐‘™๐‘œ๐‘”๐‘–๐‘_๐‘ฃ๐‘’๐‘๐‘ก๐‘œ๐‘Ÿ(๐‘ข๐‘›๐‘ ๐‘–๐‘”๐‘›๐‘’๐‘‘(๐‘Ž_๐‘–) + ๐‘ข๐‘›๐‘ ๐‘–๐‘”๐‘›๐‘’๐‘‘(๐‘_๐‘–));

Then synth tool such as Xilinx Vivado understands these two lines are actually the same and behaves them like there is one single assignment. Gives no warning at all.

In my opinion, it would be good to give an error for multi-driven net and at least give a warning about the second condition.

Please share your thoughts in comment section.

โ€œ๐‘บ๐’‰๐’‚๐’“๐’Š๐’๐’ˆ ๐’Œ๐’๐’๐’˜๐’๐’†๐’…๐’ˆ๐’† ๐’Š๐’” ๐’•๐’‰๐’† ๐’Ž๐’๐’”๐’• ๐’†๐’‡๐’‡๐’Š๐’„๐’Š๐’†๐’๐’• ๐’๐’†๐’‚๐’“๐’๐’Š๐’๐’ˆ ๐’Ž๐’†๐’•๐’‰๐’๐’…โ€

โ† All posts