下面是我的 Handel-C 代码,它可以通过 FPGA VGA 在显示器上显示一个球。但是当我尝试在监视器中显示一个球和一个框时,它只显示第一个,如果我禁用球,那么我可以显示一个框。
球和盒子的行为相似,只是大小和初始位置不同。
有谁知道那里发生了什么?
#include <stdlib.hch>
#include "tpad.hch"
#include "ball.hch"
set family = AlteraCycloneIII; /* Really a Cyclone IV */
set part = "EP4CE115F29C7";
interface bus_in (unsigned 1 pin) clock_pin () with {data = {"Y2"}};
interface altpll (unsigned 5 clk with {clockport = 1})
pll (unsigned 2 inclk = 0 @ clock_pin.pin)
with {
busformat = "B[N:0]",
properties = {
{"bandwidth_type", "AUTO"},
{"clk0_divide_by", "5"},
{"clk0_duty_cycle", "50"},
{"clk0_multiply_by", "4"},
{"clk0_phase_shift", "0"},
{"compensate_clock", "CLK0"},
{"inclk0_input_frequency", "20000"},
{"intended_device_family", "Cyclone IV E"},
{"lpm_hint", "CBX_MODULE_PREFIX=pll"},
{"lpm_type", "altpll"},
{"operation_mode", "NORMAL"},
{"pll_type", "AUTO"},
{"port_clk0", "PORT_USED"},
{"width_clock", "5"}},
bind = 1};
set clock = internal pll.clk[0];
void main( void ) {
lcd_data lcd;
par {
lcd_data lcd;
Ball ball, box;
initialise_ball( ball ); // Initialise ball structure before starting
initialise_box (box);
par {
lcd_driver( lcd ); // Run display driver in parallel
while (lcd.v_ena) // While vertical enable is true
do par{
display_ball( lcd, ball ); // display ball
display_box (lcd, box);
// update_ball( ball ); // update ball position
// while (!lcd.v_ena) delay; // While vertical enable is false
} while (1);
}
}
}