首页 > 解决方案 > 使用 Altera Cyclone FPGA 在 quartus 中低逻辑电平打开 LED 和高逻辑电平关闭 LED

问题描述

我有一块带有 EP4CE6E22C8 FPGA 的开发板。我在 Quartus Prime 中有以下 verilog 代码:

module Test(out);

output [7:0] out;
assign out = 8'b00111100;

endmodule 

引脚规划器已按照原理图所示进行配置。问题是0打开LED,1关闭LED。我认为这是一种奇怪的行为,因为典型的行为是 1=on 和 0=off。

任何人都知道是否有任何选项(在 pin planner、quartus prime 或其他)来改变这种行为?

谢谢。

标签: fpgaquartusintel-fpga

解决方案


该行为取决于电路板以及 LED 如何连接到 PIN。在外部,需要一个低电平来激活 LED。

您可以通过总是有用的抽象来改变行为。

module Test(out);

output [7:0] out;
wire   [7:0] my_led;

// The application layer
assign my_led = 8'b11000011;  // All inverted from the original

// The hardware abstraction layer
assign out = ~my_led;  // Bitwise invert make the polarity as you desire.
endmodule

推荐阅读