前言
我的最终目的还是想在FPGA上做一个小游戏,具体做啥还没想好但是需要一些基本的素材,所以先在屏幕上画一个X出来再说,就像下面这个图:
制作
有一个基础的tft模块已经在 【FPGA的小娱乐】tft显示屏生成信号辅助测试阵列 里说明过了,就是提供chan_in作为输入接口的tft_ctrl模块,基于这个模块的接口可以很简单的做出来画矩形的模块:
module square_gen(
input [10-1:0]x_point,
input [10-1:0]y_point,
input [10-1:0]x_size,
input [10-1:0]y_size,
input [8 -1:0]r,
input [8 -1:0]g,
input [8 -1:0]b,
input [10-1:0]hcount,
input [10-1:0]vcount,
input power_en,
output chan_en,
output[24-1:0]chan_data
);
wire [10-1:0]x_left = x_point;
wire [10-1:0]x_right = (x_point + x_size >= 11'd480) ? 10'd480 : x_point + x_size;
wire [10-1:0]y_top = y_point;
wire [