新来这里的。
Ice40有一个RGB驱动程序,它也可以作为一个正常IO分配。
尝试访问引脚而不将其设置为IO将给出一个IceCube2错误。
约束IO放置E2792中的错误:实例ipInertedIOPad_LED_B在SB_IO_OD位置被不正确地约束
为此,使用了以下verilog:
SB_IO_OD #( // open drain IP instance
.PIN_TYPE(6'b011001) // configure as output
) pin_out_driver (
.PACKAGEPIN(LED_B), // connect to this pin
.DOUT0(ledb) // output the state of "led"
);因此,最终的verilog代码看起来像(简化为1 led):
module top (output LED_R, output LED_G, output LED_B);
reg ledb = 0;
reg [3:0] cnt;
SB_IO_OD #( // open drain IP instance
.PIN_TYPE(6'b011001) // configure as output
) pin_out_driver (
.PACKAGEPIN(LED_B), // connect to this pin
.DOUT0(ledb) // output the state of "led"
);
always
begin
ledb = ~cnt[2];
end
always @(posedge clkout)
begin
cnt <= cnt + 1;
end
endmodule而且确实有用。
但是,我在一个始终块中分配了led,据我所理解,这是连续的。会以“正确”的方式将分类帐指定为一条线路,但却与SB_IO_OD不兼容。
这是正确的方法,还是有一种非顺序的方式来分配led,基本上没有在始终块中分配。
发布于 2022-02-07 00:57:29
经过一番挖掘,我相信这是正确的方法。它使用的逻辑单元也要少得多。
IceCube2上的工作代码,简单的LED闪光灯:
module top (output LED_R, output LED_G, output LED_B);
wire [2:0] leds;
reg [2:0] cnt;
SB_IO_OD #( // open drain IP instance
.PIN_TYPE(6'b011001) // configure as output
) pin_out_driver (
.PACKAGEPIN(LED_B), // connect to this pin
.DOUT0(leds[0]) // output the state of "led"
);
SB_IO_OD #( // open drain IP instance
.PIN_TYPE(6'b011001) // configure as output
) pin_out_driver2 (
.PACKAGEPIN(LED_G), // connect to this pin
.DOUT0(leds[1]) // output the state of "led"
);
SB_IO_OD #( // open drain IP instance
.PIN_TYPE(6'b011001) // configure as output
) pin_out_driver3 (
.PACKAGEPIN(LED_R), // connect to this pin
.DOUT0(leds[2]) // output the state of "led"
);
wire sysclk;
SB_HFOSC #(.CLKHF_DIV("0b00")) osc (
.CLKHFEN(1'b1),
.CLKHFPU(1'b1),
.CLKHF(sysclk)
) /* synthesis ROUTE_THROUGH_FABRIC = 0 */;
wire clkout;
clockdivider #(.bits(28)) div(
.clkin(sysclk),
.clkout(clkout),
.div(28'd48000000)
);
assign leds = {~cnt[2:0]};
always @(posedge clkout)
begin
cnt <= cnt + 1;
end
endmodulehttps://stackoverflow.com/questions/71012326
复制相似问题