嘿,我想知道在 VHDL 中是否有可能将两者STD_LOGIC_VECTORS
结合在一起。例如,我正在编写一个将字符输出到 VGA 监视器的 VHDL 程序。我有一个向量PixelRow: IN STD_LOGIC_VECTOR(9 DOWNTO 0)
和PixelColumn: IN STD_LOGIC_VECTOR(9 DOWNTO 0)
。我想要做的是有一个STD_LOGIC
输出,它采用两个像素向量并将它们与另一个向量进行与运算,例如。
Output <= (PixelRow AND NOT "0000000000") OR (PixelColumn AND NOT "0000000000") OR
(PixelRow AND NOT "0111011111") OR (PixelColumn AND NOT "1001111111");
我希望这段代码可用于简化以下代码:
Output <= ((NOT PixelRow(0) AND NOT PixelRow(1) AND NOT PixelRow(2) AND NOT
PixelRow(3) AND NOT PixelRow(4) AND NOT PixelRow(5) AND NOT PixelRow(6)
AND NOT PixelRow(7) AND NOT PixelRow(8) AND NOT PixelRow(9)))
OR ((NOT PixelRow(0) AND PixelRow(1) AND PixelRow(2) AND PixelRow(3) AND
NOT PixelRow(4) AND PixelRow(5) AND PixelRow(6) AND PixelRow(7) AND
PixelRow(8) AND PixelRow(9)))
OR ((NOT PixelColumn(0) AND NOT PixelColumn(1) AND NOT PixelColumn(2) AND
NOT PixelColumn(3) AND NOT PixelColumn(4) AND NOT PixelColumn(5) AND NOT
PixelColumn(6) AND NOT PixelColumn(7) AND NOT PixelColumn(8) AND NOT
PixelColumn(9)))
OR ((PixelColumn(0) AND NOT PixelColumn(1) AND NOT PixelColumn(2) AND
PixelColumn(3) AND PixelColumn(4) AND PixelColumn(5) AND PixelColumn(6)
AND PixelColumn(7) AND PixelColumn(8) AND PixelColumn(9)));
较大的代码块在屏幕周围绘制了一个框。我希望有一个更简单的方法来做到这一点。有人知道如何简化此代码吗?
谢谢