之前也陆陆续续看了很多博客,也都能在自己的屏幕上显示出来,但是问题就是不知道怎么修改代码显示自己希望显示的东西,而且由于没注释原因看不太懂
最终的实现效果最终实现效果视频
b站视频链接1(评论区有人给了源码的百度网盘链接)
csdn博客链接1
csdn博客链接2
最终仔细看了这个博客,发现既简洁,又可以实现自己的目的。
本篇文章参考链接
本文在这篇博客基础上进行扩展,使其可以更方便的使用,定义如下变量mem,对应8页,每页128*8个像素
reg [7:0]mem[1023:0];
结合下面的代码往mem里写入数据即可实时显示相应图像,由于课程设计的时间仓促,写的时候代码比较乱
这个变量的定义的原因如下图所示:
图1:
图2:
该模式下数据的写入顺序可以结合上面两张图和下面这段话理解
(数据手册找芯片SSD1306的即可)
下面代码注意时间的分配和规划,也建议原博客的代码多看看,理解大致意思
端口定义
input clk,
input reset,//拨动开关SW[17]
input reset_oled,
output reg OLED_D0clk, //时钟
output reg OLED_D1, //数据
output reg OLED_RES, //复位
output reg OLED_DC, //命令/数据
这部分是将mem[count_total]给data_tem,而data_tem每个clk被赋给data_write。
其中count_total代表从0到127列的计数,count_play周期为4200个clk,在末尾有说明
reg [7:0]data_tem;
always@(posedge clk)begin
if(reset==0) data_tem<=8'h55;
else begin
if(count_play>=101 && count_play<=4100 )
begin
data_tem <= mem[count_total];//写一组数据
end//
end
end
这部分是显示一个字节的数据data_write,相当于图2的一个SEG。只要flag_write赋值1,接下来的几个count_write计数周期,即30个clk内,data_write被写入,并在屏幕上显示出来
///写8为数据或命令 30个clk
reg [7:0]data_write;
reg flag_write;
reg [5:0]count_write;
always@(posedge clk)begin
if(flag_write==1 && count_write==0)begin
count_write<=1;
end
if(flag_write==0)
begin count_write<=0; end
if(count_write>=1)begin
count_write<=count_write+1;
//if(count_write==2) OLED_DC<=0;
if(count_write==3) OLED_D0clk<=0;
if(count_write==4) OLED_D1<=data_write[7];
if(count_write==5) OLED_D0clk<=1;
if(count_write==6) OLED_D0clk<=0;
if(count_write==7) OLED_D1<=data_write[6];
if(count_write==8) OLED_D0clk<=1;
if(count_write==9) OLED_D0clk<=0;
if(count_write==10) OLED_D1<=data_write[5];
if(count_write==11) OLED_D0clk<=1;
if(count_write==12) OLED_D0clk<=0;
if(count_write==13) OLED_D1<=data_write[4];
if(count_write==14) OLED_D0clk<=1;
if(count_write==15) OLED_D0clk<=0;
if(count_write==16) OLED_D1<=data_write[3];
if(count_write==17) OLED_D0clk<=1;
if(count_write==18) OLED_D0clk<=0;
if(count_write==19) OLED_D1<=data_write[2];
if(count_write==20) OLED_D0clk<=1;
if(count_write==21) OLED_D0clk<=0;
if(count_write==22) OLED_D1<=data_write[1];
if(count_write==23) OLED_D0clk<=1;
if(count_write==24) OLED_D0clk<=0;
if(count_write==25) OLED_D1<=data_write[0];
if(count_write==26) OLED_D0clk<=1;
if(count_write==27) count_write<=0;
end
end
这里有两大段,第一段是初始化,第二段是我加的,大致就是将4200clk的大部分时间分给128份给每一列,其中每份不小于30clk,每次count_total加1,并让flag_write为1,
最后同时完成页数的切换
//reset=0且flag_initial=0时进入 -> flag_initial++,初始化 -> flag_initial=0且reset=1,无法进入前两个条件
//写控制指令的时间都是30个clk
reg flag_initial;
reg [19:0]count_initial;
reg [15:0]count_play;
reg [2:0] count_page;
reg [9:0]count_total;
//initial begin flag_initial=0;flag_write=0;count_page=0;count_write=0;data_write=0;end
initial begin flag_initial=0;count_page=0;count_write=0;end
always@(posedge clk)begin
if((reset==0||reset_oled==0) && flag_initial==0) begin
flag_initial<=1;count_initial<=0;flag_write<=0;count_play<=0;
end
else if(flag_initial==1)begin
count_initial<=count_initial+1;
if(flag_write==1) flag_write<=0;
if(count_initial==100) OLED_RES<=0;
if(count_initial==500000) OLED_RES<=1;
if(count_initial==600000) OLED_DC<=0;//控制
if(count_initial==700000) begin flag_write<=1'b1;data_write<=8'hAE;end// transfer_command(0xae); //关显示
if(count_initial==700030) begin flag_write<=1'b1;data_write<=8'hD5;end// transfer_command(0xd5); //晶振频率
if(count_initial==700060) begin flag_write<=1'b1;data_write<=8'h80;end// transfer_command(0x80);
if(count_initial==700090) begin flag_write<=1'b1;data_write<=8'hA8;end// transfer_command(0xa8); //duty设置
if(count_initial==700120) begin flag_write<=1'b1;data_write<=8'h3F;end// transfer_command(0x3f); //duty=1/64
if(count_initial==700150) begin flag_write<=1'b1;data_write<=8'hD3;end// transfer_command(0xd3); //显示偏移
if(count_initial==700180) begin flag_write<=1'b1;data_write<=8'h00;end// transfer_command(0x00);
if(count_initial==700210) begin flag_write<=1'b1;data_write<=8'h40;end// transfer_command(0x40); //起始行
if(count_initial==700240) begin flag_write<=1'b1;data_write<=8'h8D;end// transfer_command(0x8d); //升压允许
if(count_initial==700270) begin flag_write<=1'b1;data_write<=8'h14;end// transfer_command(0x14);
if(count_initial==700300) begin flag_write<=1'b1;data_write<=8'h20;end// transfer_command(0x20); //page address mode
if(count_initial==700330) begin flag_write<=1'b1;data_write<=8'h02;end// transfer_command(0x02);
if(count_initial==700360) begin flag_write<=1'b1;data_write<=8'hC8;end// transfer_command(0xc8); //行扫描顺序:从上到下 //c1
if(count_initial==700390) begin flag_write<=1'b1;data_write<=8'hA1;end// transfer_command(0xa1); //列扫描顺序:从左到右 //a0
if(count_initial==700420) begin flag_write<=1'b1;data_write<=8'hDA;end// transfer_command(0xda); //sequential configuration
if(count_initial==700450) begin flag_write<=1'b1;data_write<=8'h12;end// transfer_command(0x12);
if(count_initial==700480) begin flag_write<=1'b1;data_write<=8'h81;end// transfer_command(0x81); //微调对比度,本指令的0x81不要改动,改下面的值
if(count_initial==700510) begin flag_write<=1'b1;data_write<=8'hCF;end// transfer_command(0xcf); //微调对比度的值,可设置范围0x00~0xff
if(count_initial==700540) begin flag_write<=1'b1;data_write<=8'hD9;end// transfer_command(0xd9); //Set Pre-Charge Period
if(count_initial==700570) begin flag_write<=1'b1;data_write<=8'hF1;end// transfer_command(0xf1);
if(count_initial==700600) begin flag_write<=1'b1;data_write<=8'hDB;end// transfer_command(0xdb); //Set VCOMH Deselect Level
if(count_initial==700630) begin flag_write<=1'b1;data_write<=8'h40;end// transfer_command(0x40);
if(count_initial==700660) begin flag_write<=1'b1;data_write<=8'hAF;end// transfer_command(0xaf); //开显示
if(count_initial==720000) begin flag_initial<=0;end
end
else begin
count_play<=count_play+1;
if(flag_write==1) flag_write<=0;
//dc = 0,写命令
if(count_play==9) begin OLED_DC<=0;end//控制
//写page页数
if(count_play==10) begin flag_write<=1;data_write<=8'hB0+count_page[2:0];end//0~7设置页地址。每页是8行。一个画面的64行被分成8个页。
if(count_play==40) begin flag_write<=1;data_write<=8'h10;end//设置列地址的高4位8'h1_ 0~127
if(count_play==70) begin flag_write<=1;data_write<=8'h00;end//设置列地址的低4位8'h0_ 0~127
if(count_play==100)begin OLED_DC<=1;end//数据
if(count_play>=101 && count_play<=4100 )
begin
//flag_write<=1;
data_write<=data_tem;
if(count_play==141)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==150)flag_write<=1'b0;
if(count_play==171)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==180)flag_write<=1'b0;
if(count_play==201)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==210)flag_write<=1'b0;
if(count_play==231)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==240)flag_write<=1'b0;
if(count_play==261)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==270)flag_write<=1'b0;
if(count_play==291)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==300)flag_write<=1'b0;
if(count_play==321)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==330)flag_write<=1'b0;
if(count_play==351)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==360)flag_write<=1'b0;
if(count_play==381)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==390)flag_write<=1'b0;
if(count_play==411)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==420)flag_write<=1'b0;
if(count_play==441)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==450)flag_write<=1'b0;
if(count_play==471)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==480)flag_write<=1'b0;
if(count_play==501)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==510)flag_write<=1'b0;
if(count_play==531)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==540)flag_write<=1'b0;
if(count_play==561)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==570)flag_write<=1'b0;
if(count_play==591)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==600)flag_write<=1'b0;
if(count_play==621)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==630)flag_write<=1'b0;
if(count_play==651)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==660)flag_write<=1'b0;
if(count_play==681)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==690)flag_write<=1'b0;
if(count_play==711)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==720)flag_write<=1'b0;
if(count_play==741)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==750)flag_write<=1'b0;
if(count_play==771)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==780)flag_write<=1'b0;
if(count_play==801)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==810)flag_write<=1'b0;
if(count_play==831)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==840)flag_write<=1'b0;
if(count_play==861)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==870)flag_write<=1'b0;
if(count_play==891)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==900)flag_write<=1'b0;
if(count_play==921)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==930)flag_write<=1'b0;
if(count_play==951)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==960)flag_write<=1'b0;
if(count_play==981)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==990)flag_write<=1'b0;
if(count_play==1011)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1020)flag_write<=1'b0;
if(count_play==1041)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1050)flag_write<=1'b0;
if(count_play==1071)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1080)flag_write<=1'b0;
if(count_play==1101)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1110)flag_write<=1'b0;
if(count_play==1131)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1140)flag_write<=1'b0;
if(count_play==1161)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1170)flag_write<=1'b0;
if(count_play==1191)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1200)flag_write<=1'b0;
if(count_play==1221)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1230)flag_write<=1'b0;
if(count_play==1251)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1260)flag_write<=1'b0;
if(count_play==1281)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1290)flag_write<=1'b0;
if(count_play==1311)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1320)flag_write<=1'b0;
if(count_play==1341)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1350)flag_write<=1'b0;
if(count_play==1371)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1380)flag_write<=1'b0;
if(count_play==1401)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1410)flag_write<=1'b0;
if(count_play==1431)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1440)flag_write<=1'b0;
if(count_play==1461)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1470)flag_write<=1'b0;
if(count_play==1491)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1500)flag_write<=1'b0;
if(count_play==1521)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1530)flag_write<=1'b0;
if(count_play==1551)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1560)flag_write<=1'b0;
if(count_play==1581)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1590)flag_write<=1'b0;
if(count_play==1611)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1620)flag_write<=1'b0;
if(count_play==1641)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1650)flag_write<=1'b0;
if(count_play==1671)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1680)flag_write<=1'b0;
if(count_play==1701)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1710)flag_write<=1'b0;
if(count_play==1731)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1740)flag_write<=1'b0;
if(count_play==1761)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1770)flag_write<=1'b0;
if(count_play==1791)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1800)flag_write<=1'b0;
if(count_play==1821)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1830)flag_write<=1'b0;
if(count_play==1851)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1860)flag_write<=1'b0;
if(count_play==1881)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1890)flag_write<=1'b0;
if(count_play==1911)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1920)flag_write<=1'b0;
if(count_play==1941)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1950)flag_write<=1'b0;
if(count_play==1971)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==1980)flag_write<=1'b0;
if(count_play==2001)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2010)flag_write<=1'b0;
if(count_play==2031)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2040)flag_write<=1'b0;
if(count_play==2061)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2070)flag_write<=1'b0;
if(count_play==2091)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2100)flag_write<=1'b0;
if(count_play==2121)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2130)flag_write<=1'b0;
if(count_play==2151)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2160)flag_write<=1'b0;
if(count_play==2181)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2190)flag_write<=1'b0;
if(count_play==2211)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2220)flag_write<=1'b0;
if(count_play==2241)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2250)flag_write<=1'b0;
if(count_play==2271)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2280)flag_write<=1'b0;
if(count_play==2301)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2310)flag_write<=1'b0;
if(count_play==2331)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2340)flag_write<=1'b0;
if(count_play==2361)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2370)flag_write<=1'b0;
if(count_play==2391)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2400)flag_write<=1'b0;
if(count_play==2421)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2430)flag_write<=1'b0;
if(count_play==2451)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2460)flag_write<=1'b0;
if(count_play==2481)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2490)flag_write<=1'b0;
if(count_play==2511)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2520)flag_write<=1'b0;
if(count_play==2541)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2550)flag_write<=1'b0;
if(count_play==2571)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2580)flag_write<=1'b0;
if(count_play==2601)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2610)flag_write<=1'b0;
if(count_play==2631)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2640)flag_write<=1'b0;
if(count_play==2661)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2670)flag_write<=1'b0;
if(count_play==2691)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2700)flag_write<=1'b0;
if(count_play==2721)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2730)flag_write<=1'b0;
if(count_play==2751)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2760)flag_write<=1'b0;
if(count_play==2781)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2790)flag_write<=1'b0;
if(count_play==2811)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2820)flag_write<=1'b0;
if(count_play==2841)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2850)flag_write<=1'b0;
if(count_play==2871)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2880)flag_write<=1'b0;
if(count_play==2901)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2910)flag_write<=1'b0;
if(count_play==2931)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2940)flag_write<=1'b0;
if(count_play==2961)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==2970)flag_write<=1'b0;
if(count_play==2991)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3000)flag_write<=1'b0;
if(count_play==3021)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3030)flag_write<=1'b0;
if(count_play==3051)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3060)flag_write<=1'b0;
if(count_play==3081)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3090)flag_write<=1'b0;
if(count_play==3111)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3120)flag_write<=1'b0;
if(count_play==3141)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3150)flag_write<=1'b0;
if(count_play==3171)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3180)flag_write<=1'b0;
if(count_play==3201)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3210)flag_write<=1'b0;
if(count_play==3231)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3240)flag_write<=1'b0;
if(count_play==3261)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3270)flag_write<=1'b0;
if(count_play==3291)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3300)flag_write<=1'b0;
if(count_play==3321)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3330)flag_write<=1'b0;
if(count_play==3351)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3360)flag_write<=1'b0;
if(count_play==3381)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3390)flag_write<=1'b0;
if(count_play==3411)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3420)flag_write<=1'b0;
if(count_play==3441)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3450)flag_write<=1'b0;
if(count_play==3471)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3480)flag_write<=1'b0;
if(count_play==3501)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3510)flag_write<=1'b0;
if(count_play==3531)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3540)flag_write<=1'b0;
if(count_play==3561)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3570)flag_write<=1'b0;
if(count_play==3591)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3600)flag_write<=1'b0;
if(count_play==3621)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3630)flag_write<=1'b0;
if(count_play==3651)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3660)flag_write<=1'b0;
if(count_play==3681)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3690)flag_write<=1'b0;
if(count_play==3711)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3720)flag_write<=1'b0;
if(count_play==3741)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3750)flag_write<=1'b0;
if(count_play==3771)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3780)flag_write<=1'b0;
if(count_play==3801)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3810)flag_write<=1'b0;
if(count_play==3831)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3840)flag_write<=1'b0;
if(count_play==3861)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3870)flag_write<=1'b0;
if(count_play==3891)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3900)flag_write<=1'b0;
if(count_play==3921)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3930)flag_write<=1'b0;
if(count_play==3951)begin flag_write<=1'b1;count_total<=count_total+10'b1;end if(count_play==3960)flag_write<=1'b0;
end//
if(count_play==4200)
begin
count_page<=count_page+1'b1;
count_play<=1'b0;
if(count_page==3'h7)
count_total<=10'b1111111111;//负1
end
end
end
为了更方便地显示图像,我将屏幕用8*8的小格子划分,用image_x_y表示第x行第y列的格子(当然也可以直接往mem里面赋值)
该64位reg对应的位表示的位置,如下:
0,8,16,24,32,40,48,56,
1,9,17,25,33,41,49,57,
2,10,18,26,34,42,50,58,
3,11,19,27,35,43,51,59,
4,12,20,28,36,44,52,60,
5,13,21,29,37,45,53,61,
6,14,22,30,38,46,54,62,
7,15,23,31,39,47,55,63
reg [63:0] image_1_1,image_1_2,image_1_3,image_1_4,image_1_5,image_1_6,image_1_7,image_1_8,image_1_9,image_1_10,image_1_11,image_1_12,image_1_13,image_1_14,image_1_15,image_1_16,
image_2_1,image_2_2,image_2_3,image_2_4,image_2_5,image_2_6,image_2_7,image_2_8,image_2_9,image_2_10,image_2_11,image_2_12,image_2_13,image_2_14,image_2_15,image_2_16,
image_3_1,image_3_2,image_3_3,image_3_4,image_3_5,image_3_6,image_3_7,image_3_8,image_3_9,image_3_10,image_3_11,image_3_12,image_3_13,image_3_14,image_3_15,image_3_16,
image_4_1,image_4_2,image_4_3,image_4_4,image_4_5,image_4_6,image_4_7,image_4_8,image_4_9,image_4_10,image_4_11,image_4_12,image_4_13,image_4_14,image_4_15,image_4_16,
image_5_1,image_5_2,image_5_3,image_5_4,image_5_5,image_5_6,image_5_7,image_5_8,image_5_9,image_5_10,image_5_11,image_5_12,image_5_13,image_5_14,image_5_15,image_5_16,
image_6_1,image_6_2,image_6_3,image_6_4,image_6_5,image_6_6,image_6_7,image_6_8,image_6_9,image_6_10,image_6_11,image_6_12,image_6_13,image_6_14,image_6_15,image_6_16,
image_7_1,image_7_2,image_7_3,image_7_4,image_7_5,image_7_6,image_7_7,image_7_8,image_7_9,image_7_10,image_7_11,image_7_12,image_7_13,image_7_14,image_7_15,image_7_16,
image_8_1,image_8_2,image_8_3,image_8_4,image_8_5,image_8_6,image_8_7,image_8_8,image_8_9,image_8_10,image_8_11,image_8_12,image_8_13,image_8_14,image_8_15,image_8_16;
mem[0]<={image_1_1[7:0]};mem[1]<={image_1_1[15:8]};mem[2]<={image_1_1[23:16]};mem[3]<={image_1_1[31:24]};mem[4]<={image_1_1[39:32]};mem[5]<={image_1_1[47:40]};mem[6]<={image_1_1[55:48]};mem[7]<={image_1_1[63:56]};
mem[8]<={image_1_2[7:0]};mem[9]<={image_1_2[15:8]};mem[10]<={image_1_2[23:16]};mem[11]<={image_1_2[31:24]};mem[12]<={image_1_2[39:32]};mem[13]<={image_1_2[47:40]};mem[14]<={image_1_2[55:48]};mem[15]<={image_1_2[63:56]};
mem[16]<={image_1_3[7:0]};mem[17]<={image_1_3[15:8]};mem[18]<={image_1_3[23:16]};mem[19]<={image_1_3[31:24]};mem[20]<={image_1_3[39:32]};mem[21]<={image_1_3[47:40]};mem[22]<={image_1_3[55:48]};mem[23]<={image_1_3[63:56]};
mem[24]<={image_1_4[7:0]};mem[25]<={image_1_4[15:8]};mem[26]<={image_1_4[23:16]};mem[27]<={image_1_4[31:24]};mem[28]<={image_1_4[39:32]};mem[29]<={image_1_4[47:40]};mem[30]<={image_1_4[55:48]};mem[31]<={image_1_4[63:56]};
mem[32]<={image_1_5[7:0]};mem[33]<={image_1_5[15:8]};mem[34]<={image_1_5[23:16]};mem[35]<={image_1_5[31:24]};mem[36]<={image_1_5[39:32]};mem[37]<={image_1_5[47:40]};mem[38]<={image_1_5[55:48]};mem[39]<={image_1_5[63:56]};
mem[40]<={image_1_6[7:0]};mem[41]<={image_1_6[15:8]};mem[42]<={image_1_6[23:16]};mem[43]<={image_1_6[31:24]};mem[44]<={image_1_6[39:32]};mem[45]<={image_1_6[47:40]};mem[46]<={image_1_6[55:48]};mem[47]<={image_1_6[63:56]};
mem[48]<={image_1_7[7:0]};mem[49]<={image_1_7[15:8]};mem[50]<={image_1_7[23:16]};mem[51]<={image_1_7[31:24]};mem[52]<={image_1_7[39:32]};mem[53]<={image_1_7[47:40]};mem[54]<={image_1_7[55:48]};mem[55]<={image_1_7[63:56]};
mem[56]<={image_1_8[7:0]};mem[57]<={image_1_8[15:8]};mem[58]<={image_1_8[23:16]};mem[59]<={image_1_8[31:24]};mem[60]<={image_1_8[39:32]};mem[61]<={image_1_8[47:40]};mem[62]<={image_1_8[55:48]};mem[63]<={image_1_8[63:56]};
mem[64]<={image_1_9[7:0]};mem[65]<={image_1_9[15:8]};mem[66]<={image_1_9[23:16]};mem[67]<={image_1_9[31:24]};mem[68]<={image_1_9[39:32]};mem[69]<={image_1_9[47:40]};mem[70]<={image_1_9[55:48]};mem[71]<={image_1_9[63:56]};
mem[72]<={image_1_10[7:0]};mem[73]<={image_1_10[15:8]};mem[74]<={image_1_10[23:16]};mem[75]<={image_1_10[31:24]};mem[76]<={image_1_10[39:32]};mem[77]<={image_1_10[47:40]};mem[78]<={image_1_10[55:48]};mem[79]<={image_1_10[63:56]};
mem[80]<={image_1_11[7:0]};mem[81]<={image_1_11[15:8]};mem[82]<={image_1_11[23:16]};mem[83]<={image_1_11[31:24]};mem[84]<={image_1_11[39:32]};mem[85]<={image_1_11[47:40]};mem[86]<={image_1_11[55:48]};mem[87]<={image_1_11[63:56]};
mem[88]<={image_1_12[7:0]};mem[89]<={image_1_12[15:8]};mem[90]<={image_1_12[23:16]};mem[91]<={image_1_12[31:24]};mem[92]<={image_1_12[39:32]};mem[93]<={image_1_12[47:40]};mem[94]<={image_1_12[55:48]};mem[95]<={image_1_12[63:56]};
mem[96]<={image_1_13[7:0]};mem[97]<={image_1_13[15:8]};mem[98]<={image_1_13[23:16]};mem[99]<={image_1_13[31:24]};mem[100]<={image_1_13[39:32]};mem[101]<={image_1_13[47:40]};mem[102]<={image_1_13[55:48]};mem[103]<={image_1_13[63:56]};
mem[104]<={image_1_14[7:0]};mem[105]<={image_1_14[15:8]};mem[106]<={image_1_14[23:16]};mem[107]<={image_1_14[31:24]};mem[108]<={image_1_14[39:32]};mem[109]<={image_1_14[47:40]};mem[110]<={image_1_14[55:48]};mem[111]<={image_1_14[63:56]};
mem[112]<={image_1_15[7:0]};mem[113]<={image_1_15[15:8]};mem[114]<={image_1_15[23:16]};mem[115]<={image_1_15[31:24]};mem[116]<={image_1_15[39:32]};mem[117]<={image_1_15[47:40]};mem[118]<={image_1_15[55:48]};mem[119]<={image_1_15[63:56]};
mem[120]<={image_1_16[7:0]};mem[121]<={image_1_16[15:8]};mem[122]<={image_1_16[23:16]};mem[123]<={image_1_16[31:24]};mem[124]<={image_1_16[39:32]};mem[125]<={image_1_16[47:40]};mem[126]<={image_1_16[55:48]};mem[127]<={image_1_16[63:56]};
mem[128]<={image_2_1[7:0]};mem[129]<={image_2_1[15:8]};mem[130]<={image_2_1[23:16]};mem[131]<={image_2_1[31:24]};mem[132]<={image_2_1[39:32]};mem[133]<={image_2_1[47:40]};mem[134]<={image_2_1[55:48]};mem[135]<={image_2_1[63:56]};
mem[136]<={image_2_2[7:0]};mem[137]<={image_2_2[15:8]};mem[138]<={image_2_2[23:16]};mem[139]<={image_2_2[31:24]};mem[140]<={image_2_2[39:32]};mem[141]<={image_2_2[47:40]};mem[142]<={image_2_2[55:48]};mem[143]<={image_2_2[63:56]};
mem[144]<={image_2_3[7:0]};mem[145]<={image_2_3[15:8]};mem[146]<={image_2_3[23:16]};mem[147]<={image_2_3[31:24]};mem[148]<={image_2_3[39:32]};mem[149]<={image_2_3[47:40]};mem[150]<={image_2_3[55:48]};mem[151]<={image_2_3[63:56]};
mem[152]<={image_2_4[7:0]};mem[153]<={image_2_4[15:8]};mem[154]<={image_2_4[23:16]};mem[155]<={image_2_4[31:24]};mem[156]<={image_2_4[39:32]};mem[157]<={image_2_4[47:40]};mem[158]<={image_2_4[55:48]};mem[159]<={image_2_4[63:56]};
mem[160]<={image_2_5[7:0]};mem[161]<={image_2_5[15:8]};mem[162]<={image_2_5[23:16]};mem[163]<={image_2_5[31:24]};mem[164]<={image_2_5[39:32]};mem[165]<={image_2_5[47:40]};mem[166]<={image_2_5[55:48]};mem[167]<={image_2_5[63:56]};
mem[168]<={image_2_6[7:0]};mem[169]<={image_2_6[15:8]};mem[170]<={image_2_6[23:16]};mem[171]<={image_2_6[31:24]};mem[172]<={image_2_6[39:32]};mem[173]<={image_2_6[47:40]};mem[174]<={image_2_6[55:48]};mem[175]<={image_2_6[63:56]};
mem[176]<={image_2_7[7:0]};mem[177]<={image_2_7[15:8]};mem[178]<={image_2_7[23:16]};mem[179]<={image_2_7[31:24]};mem[180]<={image_2_7[39:32]};mem[181]<={image_2_7[47:40]};mem[182]<={image_2_7[55:48]};mem[183]<={image_2_7[63:56]};
mem[184]<={image_2_8[7:0]};mem[185]<={image_2_8[15:8]};mem[186]<={image_2_8[23:16]};mem[187]<={image_2_8[31:24]};mem[188]<={image_2_8[39:32]};mem[189]<={image_2_8[47:40]};mem[190]<={image_2_8[55:48]};mem[191]<={image_2_8[63:56]};
mem[192]<={image_2_9[7:0]};mem[193]<={image_2_9[15:8]};mem[194]<={image_2_9[23:16]};mem[195]<={image_2_9[31:24]};mem[196]<={image_2_9[39:32]};mem[197]<={image_2_9[47:40]};mem[198]<={image_2_9[55:48]};mem[199]<={image_2_9[63:56]};
mem[200]<={image_2_10[7:0]};mem[201]<={image_2_10[15:8]};mem[202]<={image_2_10[23:16]};mem[203]<={image_2_10[31:24]};mem[204]<={image_2_10[39:32]};mem[205]<={image_2_10[47:40]};mem[206]<={image_2_10[55:48]};mem[207]<={image_2_10[63:56]};
mem[208]<={image_2_11[7:0]};mem[209]<={image_2_11[15:8]};mem[210]<={image_2_11[23:16]};mem[211]<={image_2_11[31:24]};mem[212]<={image_2_11[39:32]};mem[213]<={image_2_11[47:40]};mem[214]<={image_2_11[55:48]};mem[215]<={image_2_11[63:56]};
mem[216]<={image_2_12[7:0]};mem[217]<={image_2_12[15:8]};mem[218]<={image_2_12[23:16]};mem[219]<={image_2_12[31:24]};mem[220]<={image_2_12[39:32]};mem[221]<={image_2_12[47:40]};mem[222]<={image_2_12[55:48]};mem[223]<={image_2_12[63:56]};
mem[224]<={image_2_13[7:0]};mem[225]<={image_2_13[15:8]};mem[226]<={image_2_13[23:16]};mem[227]<={image_2_13[31:24]};mem[228]<={image_2_13[39:32]};mem[229]<={image_2_13[47:40]};mem[230]<={image_2_13[55:48]};mem[231]<={image_2_13[63:56]};
mem[232]<={image_2_14[7:0]};mem[233]<={image_2_14[15:8]};mem[234]<={image_2_14[23:16]};mem[235]<={image_2_14[31:24]};mem[236]<={image_2_14[39:32]};mem[237]<={image_2_14[47:40]};mem[238]<={image_2_14[55:48]};mem[239]<={image_2_14[63:56]};
mem[240]<={image_2_15[7:0]};mem[241]<={image_2_15[15:8]};mem[242]<={image_2_15[23:16]};mem[243]<={image_2_15[31:24]};mem[244]<={image_2_15[39:32]};mem[245]<={image_2_15[47:40]};mem[246]<={image_2_15[55:48]};mem[247]<={image_2_15[63:56]};
mem[248]<={image_2_16[7:0]};mem[249]<={image_2_16[15:8]};mem[250]<={image_2_16[23:16]};mem[251]<={image_2_16[31:24]};mem[252]<={image_2_16[39:32]};mem[253]<={image_2_16[47:40]};mem[254]<={image_2_16[55:48]};mem[255]<={image_2_16[63:56]};
mem[256]<={image_3_1[7:0]};mem[257]<={image_3_1[15:8]};mem[258]<={image_3_1[23:16]};mem[259]<={image_3_1[31:24]};mem[260]<={image_3_1[39:32]};mem[261]<={image_3_1[47:40]};mem[262]<={image_3_1[55:48]};mem[263]<={image_3_1[63:56]};
mem[264]<={image_3_2[7:0]};mem[265]<={image_3_2[15:8]};mem[266]<={image_3_2[23:16]};mem[267]<={image_3_2[31:24]};mem[268]<={image_3_2[39:32]};mem[269]<={image_3_2[47:40]};mem[270]<={image_3_2[55:48]};mem[271]<={image_3_2[63:56]};
mem[272]<={image_3_3[7:0]};mem[273]<={image_3_3[15:8]};mem[274]<={image_3_3[23:16]};mem[275]<={image_3_3[31:24]};mem[276]<={image_3_3[39:32]};mem[277]<={image_3_3[47:40]};mem[278]<={image_3_3[55:48]};mem[279]<={image_3_3[63:56]};
mem[280]<={image_3_4[7:0]};mem[281]<={image_3_4[15:8]};mem[282]<={image_3_4[23:16]};mem[283]<={image_3_4[31:24]};mem[284]<={image_3_4[39:32]};mem[285]<={image_3_4[47:40]};mem[286]<={image_3_4[55:48]};mem[287]<={image_3_4[63:56]};
mem[288]<={image_3_5[7:0]};mem[289]<={image_3_5[15:8]};mem[290]<={image_3_5[23:16]};mem[291]<={image_3_5[31:24]};mem[292]<={image_3_5[39:32]};mem[293]<={image_3_5[47:40]};mem[294]<={image_3_5[55:48]};mem[295]<={image_3_5[63:56]};
mem[296]<={image_3_6[7:0]};mem[297]<={image_3_6[15:8]};mem[298]<={image_3_6[23:16]};mem[299]<={image_3_6[31:24]};mem[300]<={image_3_6[39:32]};mem[301]<={image_3_6[47:40]};mem[302]<={image_3_6[55:48]};mem[303]<={image_3_6[63:56]};
mem[304]<={image_3_7[7:0]};mem[305]<={image_3_7[15:8]};mem[306]<={image_3_7[23:16]};mem[307]<={image_3_7[31:24]};mem[308]<={image_3_7[39:32]};mem[309]<={image_3_7[47:40]};mem[310]<={image_3_7[55:48]};mem[311]<={image_3_7[63:56]};
mem[312]<={image_3_8[7:0]};mem[313]<={image_3_8[15:8]};mem[314]<={image_3_8[23:16]};mem[315]<={image_3_8[31:24]};mem[316]<={image_3_8[39:32]};mem[317]<={image_3_8[47:40]};mem[318]<={image_3_8[55:48]};mem[319]<={image_3_8[63:56]};
mem[320]<={image_3_9[7:0]};mem[321]<={image_3_9[15:8]};mem[322]<={image_3_9[23:16]};mem[323]<={image_3_9[31:24]};mem[324]<={image_3_9[39:32]};mem[325]<={image_3_9[47:40]};mem[326]<={image_3_9[55:48]};mem[327]<={image_3_9[63:56]};
mem[328]<={image_3_10[7:0]};mem[329]<={image_3_10[15:8]};mem[330]<={image_3_10[23:16]};mem[331]<={image_3_10[31:24]};mem[332]<={image_3_10[39:32]};mem[333]<={image_3_10[47:40]};mem[334]<={image_3_10[55:48]};mem[335]<={image_3_10[63:56]};
mem[336]<={image_3_11[7:0]};mem[337]<={image_3_11[15:8]};mem[338]<={image_3_11[23:16]};mem[339]<={image_3_11[31:24]};mem[340]<={image_3_11[39:32]};mem[341]<={image_3_11[47:40]};mem[342]<={image_3_11[55:48]};mem[343]<={image_3_11[63:56]};
mem[344]<={image_3_12[7:0]};mem[345]<={image_3_12[15:8]};mem[346]<={image_3_12[23:16]};mem[347]<={image_3_12[31:24]};mem[348]<={image_3_12[39:32]};mem[349]<={image_3_12[47:40]};mem[350]<={image_3_12[55:48]};mem[351]<={image_3_12[63:56]};
mem[352]<={image_3_13[7:0]};mem[353]<={image_3_13[15:8]};mem[354]<={image_3_13[23:16]};mem[355]<={image_3_13[31:24]};mem[356]<={image_3_13[39:32]};mem[357]<={image_3_13[47:40]};mem[358]<={image_3_13[55:48]};mem[359]<={image_3_13[63:56]};
mem[360]<={image_3_14[7:0]};mem[361]<={image_3_14[15:8]};mem[362]<={image_3_14[23:16]};mem[363]<={image_3_14[31:24]};mem[364]<={image_3_14[39:32]};mem[365]<={image_3_14[47:40]};mem[366]<={image_3_14[55:48]};mem[367]<={image_3_14[63:56]};
mem[368]<={image_3_15[7:0]};mem[369]<={image_3_15[15:8]};mem[370]<={image_3_15[23:16]};mem[371]<={image_3_15[31:24]};mem[372]<={image_3_15[39:32]};mem[373]<={image_3_15[47:40]};mem[374]<={image_3_15[55:48]};mem[375]<={image_3_15[63:56]};
mem[376]<={image_3_16[7:0]};mem[377]<={image_3_16[15:8]};mem[378]<={image_3_16[23:16]};mem[379]<={image_3_16[31:24]};mem[380]<={image_3_16[39:32]};mem[381]<={image_3_16[47:40]};mem[382]<={image_3_16[55:48]};mem[383]<={image_3_16[63:56]};
mem[384]<={image_4_1[7:0]};mem[385]<={image_4_1[15:8]};mem[386]<={image_4_1[23:16]};mem[387]<={image_4_1[31:24]};mem[388]<={image_4_1[39:32]};mem[389]<={image_4_1[47:40]};mem[390]<={image_4_1[55:48]};mem[391]<={image_4_1[63:56]};
mem[392]<={image_4_2[7:0]};mem[393]<={image_4_2[15:8]};mem[394]<={image_4_2[23:16]};mem[395]<={image_4_2[31:24]};mem[396]<={image_4_2[39:32]};mem[397]<={image_4_2[47:40]};mem[398]<={image_4_2[55:48]};mem[399]<={image_4_2[63:56]};
mem[400]<={image_4_3[7:0]};mem[401]<={image_4_3[15:8]};mem[402]<={image_4_3[23:16]};mem[403]<={image_4_3[31:24]};mem[404]<={image_4_3[39:32]};mem[405]<={image_4_3[47:40]};mem[406]<={image_4_3[55:48]};mem[407]<={image_4_3[63:56]};
mem[408]<={image_4_4[7:0]};mem[409]<={image_4_4[15:8]};mem[410]<={image_4_4[23:16]};mem[411]<={image_4_4[31:24]};mem[412]<={image_4_4[39:32]};mem[413]<={image_4_4[47:40]};mem[414]<={image_4_4[55:48]};mem[415]<={image_4_4[63:56]};
mem[416]<={image_4_5[7:0]};mem[417]<={image_4_5[15:8]};mem[418]<={image_4_5[23:16]};mem[419]<={image_4_5[31:24]};mem[420]<={image_4_5[39:32]};mem[421]<={image_4_5[47:40]};mem[422]<={image_4_5[55:48]};mem[423]<={image_4_5[63:56]};
mem[424]<={image_4_6[7:0]};mem[425]<={image_4_6[15:8]};mem[426]<={image_4_6[23:16]};mem[427]<={image_4_6[31:24]};mem[428]<={image_4_6[39:32]};mem[429]<={image_4_6[47:40]};mem[430]<={image_4_6[55:48]};mem[431]<={image_4_6[63:56]};
mem[432]<={image_4_7[7:0]};mem[433]<={image_4_7[15:8]};mem[434]<={image_4_7[23:16]};mem[435]<={image_4_7[31:24]};mem[436]<={image_4_7[39:32]};mem[437]<={image_4_7[47:40]};mem[438]<={image_4_7[55:48]};mem[439]<={image_4_7[63:56]};
mem[440]<={image_4_8[7:0]};mem[441]<={image_4_8[15:8]};mem[442]<={image_4_8[23:16]};mem[443]<={image_4_8[31:24]};mem[444]<={image_4_8[39:32]};mem[445]<={image_4_8[47:40]};mem[446]<={image_4_8[55:48]};mem[447]<={image_4_8[63:56]};
mem[448]<={image_4_9[7:0]};mem[449]<={image_4_9[15:8]};mem[450]<={image_4_9[23:16]};mem[451]<={image_4_9[31:24]};mem[452]<={image_4_9[39:32]};mem[453]<={image_4_9[47:40]};mem[454]<={image_4_9[55:48]};mem[455]<={image_4_9[63:56]};
mem[456]<={image_4_10[7:0]};mem[457]<={image_4_10[15:8]};mem[458]<={image_4_10[23:16]};mem[459]<={image_4_10[31:24]};mem[460]<={image_4_10[39:32]};mem[461]<={image_4_10[47:40]};mem[462]<={image_4_10[55:48]};mem[463]<={image_4_10[63:56]};
mem[464]<={image_4_11[7:0]};mem[465]<={image_4_11[15:8]};mem[466]<={image_4_11[23:16]};mem[467]<={image_4_11[31:24]};mem[468]<={image_4_11[39:32]};mem[469]<={image_4_11[47:40]};mem[470]<={image_4_11[55:48]};mem[471]<={image_4_11[63:56]};
mem[472]<={image_4_12[7:0]};mem[473]<={image_4_12[15:8]};mem[474]<={image_4_12[23:16]};mem[475]<={image_4_12[31:24]};mem[476]<={image_4_12[39:32]};mem[477]<={image_4_12[47:40]};mem[478]<={image_4_12[55:48]};mem[479]<={image_4_12[63:56]};
mem[480]<={image_4_13[7:0]};mem[481]<={image_4_13[15:8]};mem[482]<={image_4_13[23:16]};mem[483]<={image_4_13[31:24]};mem[484]<={image_4_13[39:32]};mem[485]<={image_4_13[47:40]};mem[486]<={image_4_13[55:48]};mem[487]<={image_4_13[63:56]};
mem[488]<={image_4_14[7:0]};mem[489]<={image_4_14[15:8]};mem[490]<={image_4_14[23:16]};mem[491]<={image_4_14[31:24]};mem[492]<={image_4_14[39:32]};mem[493]<={image_4_14[47:40]};mem[494]<={image_4_14[55:48]};mem[495]<={image_4_14[63:56]};
mem[496]<={image_4_15[7:0]};mem[497]<={image_4_15[15:8]};mem[498]<={image_4_15[23:16]};mem[499]<={image_4_15[31:24]};mem[500]<={image_4_15[39:32]};mem[501]<={image_4_15[47:40]};mem[502]<={image_4_15[55:48]};mem[503]<={image_4_15[63:56]};
mem[504]<={image_4_16[7:0]};mem[505]<={image_4_16[15:8]};mem[506]<={image_4_16[23:16]};mem[507]<={image_4_16[31:24]};mem[508]<={image_4_16[39:32]};mem[509]<={image_4_16[47:40]};mem[510]<={image_4_16[55:48]};mem[511]<={image_4_16[63:56]};
mem[512]<={image_5_1[7:0]};mem[513]<={image_5_1[15:8]};mem[514]<={image_5_1[23:16]};mem[515]<={image_5_1[31:24]};mem[516]<={image_5_1[39:32]};mem[517]<={image_5_1[47:40]};mem[518]<={image_5_1[55:48]};mem[519]<={image_5_1[63:56]};
mem[520]<={image_5_2[7:0]};mem[521]<={image_5_2[15:8]};mem[522]<={image_5_2[23:16]};mem[523]<={image_5_2[31:24]};mem[524]<={image_5_2[39:32]};mem[525]<={image_5_2[47:40]};mem[526]<={image_5_2[55:48]};mem[527]<={image_5_2[63:56]};
mem[528]<={image_5_3[7:0]};mem[529]<={image_5_3[15:8]};mem[530]<={image_5_3[23:16]};mem[531]<={image_5_3[31:24]};mem[532]<={image_5_3[39:32]};mem[533]<={image_5_3[47:40]};mem[534]<={image_5_3[55:48]};mem[535]<={image_5_3[63:56]};
mem[536]<={image_5_4[7:0]};mem[537]<={image_5_4[15:8]};mem[538]<={image_5_4[23:16]};mem[539]<={image_5_4[31:24]};mem[540]<={image_5_4[39:32]};mem[541]<={image_5_4[47:40]};mem[542]<={image_5_4[55:48]};mem[543]<={image_5_4[63:56]};
mem[544]<={image_5_5[7:0]};mem[545]<={image_5_5[15:8]};mem[546]<={image_5_5[23:16]};mem[547]<={image_5_5[31:24]};mem[548]<={image_5_5[39:32]};mem[549]<={image_5_5[47:40]};mem[550]<={image_5_5[55:48]};mem[551]<={image_5_5[63:56]};
mem[552]<={image_5_6[7:0]};mem[553]<={image_5_6[15:8]};mem[554]<={image_5_6[23:16]};mem[555]<={image_5_6[31:24]};mem[556]<={image_5_6[39:32]};mem[557]<={image_5_6[47:40]};mem[558]<={image_5_6[55:48]};mem[559]<={image_5_6[63:56]};
mem[560]<={image_5_7[7:0]};mem[561]<={image_5_7[15:8]};mem[562]<={image_5_7[23:16]};mem[563]<={image_5_7[31:24]};mem[564]<={image_5_7[39:32]};mem[565]<={image_5_7[47:40]};mem[566]<={image_5_7[55:48]};mem[567]<={image_5_7[63:56]};
mem[568]<={image_5_8[7:0]};mem[569]<={image_5_8[15:8]};mem[570]<={image_5_8[23:16]};mem[571]<={image_5_8[31:24]};mem[572]<={image_5_8[39:32]};mem[573]<={image_5_8[47:40]};mem[574]<={image_5_8[55:48]};mem[575]<={image_5_8[63:56]};
mem[576]<={image_5_9[7:0]};mem[577]<={image_5_9[15:8]};mem[578]<={image_5_9[23:16]};mem[579]<={image_5_9[31:24]};mem[580]<={image_5_9[39:32]};mem[581]<={image_5_9[47:40]};mem[582]<={image_5_9[55:48]};mem[583]<={image_5_9[63:56]};
mem[584]<={image_5_10[7:0]};mem[585]<={image_5_10[15:8]};mem[586]<={image_5_10[23:16]};mem[587]<={image_5_10[31:24]};mem[588]<={image_5_10[39:32]};mem[589]<={image_5_10[47:40]};mem[590]<={image_5_10[55:48]};mem[591]<={image_5_10[63:56]};
mem[592]<={image_5_11[7:0]};mem[593]<={image_5_11[15:8]};mem[594]<={image_5_11[23:16]};mem[595]<={image_5_11[31:24]};mem[596]<={image_5_11[39:32]};mem[597]<={image_5_11[47:40]};mem[598]<={image_5_11[55:48]};mem[599]<={image_5_11[63:56]};
mem[600]<={image_5_12[7:0]};mem[601]<={image_5_12[15:8]};mem[602]<={image_5_12[23:16]};mem[603]<={image_5_12[31:24]};mem[604]<={image_5_12[39:32]};mem[605]<={image_5_12[47:40]};mem[606]<={image_5_12[55:48]};mem[607]<={image_5_12[63:56]};
mem[608]<={image_5_13[7:0]};mem[609]<={image_5_13[15:8]};mem[610]<={image_5_13[23:16]};mem[611]<={image_5_13[31:24]};mem[612]<={image_5_13[39:32]};mem[613]<={image_5_13[47:40]};mem[614]<={image_5_13[55:48]};mem[615]<={image_5_13[63:56]};
mem[616]<={image_5_14[7:0]};mem[617]<={image_5_14[15:8]};mem[618]<={image_5_14[23:16]};mem[619]<={image_5_14[31:24]};mem[620]<={image_5_14[39:32]};mem[621]<={image_5_14[47:40]};mem[622]<={image_5_14[55:48]};mem[623]<={image_5_14[63:56]};
mem[624]<={image_5_15[7:0]};mem[625]<={image_5_15[15:8]};mem[626]<={image_5_15[23:16]};mem[627]<={image_5_15[31:24]};mem[628]<={image_5_15[39:32]};mem[629]<={image_5_15[47:40]};mem[630]<={image_5_15[55:48]};mem[631]<={image_5_15[63:56]};
mem[632]<={image_5_16[7:0]};mem[633]<={image_5_16[15:8]};mem[634]<={image_5_16[23:16]};mem[635]<={image_5_16[31:24]};mem[636]<={image_5_16[39:32]};mem[637]<={image_5_16[47:40]};mem[638]<={image_5_16[55:48]};mem[639]<={image_5_16[63:56]};
mem[640]<={image_6_1[7:0]};mem[641]<={image_6_1[15:8]};mem[642]<={image_6_1[23:16]};mem[643]<={image_6_1[31:24]};mem[644]<={image_6_1[39:32]};mem[645]<={image_6_1[47:40]};mem[646]<={image_6_1[55:48]};mem[647]<={image_6_1[63:56]};
mem[648]<={image_6_2[7:0]};mem[649]<={image_6_2[15:8]};mem[650]<={image_6_2[23:16]};mem[651]<={image_6_2[31:24]};mem[652]<={image_6_2[39:32]};mem[653]<={image_6_2[47:40]};mem[654]<={image_6_2[55:48]};mem[655]<={image_6_2[63:56]};
mem[656]<={image_6_3[7:0]};mem[657]<={image_6_3[15:8]};mem[658]<={image_6_3[23:16]};mem[659]<={image_6_3[31:24]};mem[660]<={image_6_3[39:32]};mem[661]<={image_6_3[47:40]};mem[662]<={image_6_3[55:48]};mem[663]<={image_6_3[63:56]};
mem[664]<={image_6_4[7:0]};mem[665]<={image_6_4[15:8]};mem[666]<={image_6_4[23:16]};mem[667]<={image_6_4[31:24]};mem[668]<={image_6_4[39:32]};mem[669]<={image_6_4[47:40]};mem[670]<={image_6_4[55:48]};mem[671]<={image_6_4[63:56]};
mem[672]<={image_6_5[7:0]};mem[673]<={image_6_5[15:8]};mem[674]<={image_6_5[23:16]};mem[675]<={image_6_5[31:24]};mem[676]<={image_6_5[39:32]};mem[677]<={image_6_5[47:40]};mem[678]<={image_6_5[55:48]};mem[679]<={image_6_5[63:56]};
mem[680]<={image_6_6[7:0]};mem[681]<={image_6_6[15:8]};mem[682]<={image_6_6[23:16]};mem[683]<={image_6_6[31:24]};mem[684]<={image_6_6[39:32]};mem[685]<={image_6_6[47:40]};mem[686]<={image_6_6[55:48]};mem[687]<={image_6_6[63:56]};
mem[688]<={image_6_7[7:0]};mem[689]<={image_6_7[15:8]};mem[690]<={image_6_7[23:16]};mem[691]<={image_6_7[31:24]};mem[692]<={image_6_7[39:32]};mem[693]<={image_6_7[47:40]};mem[694]<={image_6_7[55:48]};mem[695]<={image_6_7[63:56]};
mem[696]<={image_6_8[7:0]};mem[697]<={image_6_8[15:8]};mem[698]<={image_6_8[23:16]};mem[699]<={image_6_8[31:24]};mem[700]<={image_6_8[39:32]};mem[701]<={image_6_8[47:40]};mem[702]<={image_6_8[55:48]};mem[703]<={image_6_8[63:56]};
mem[704]<={image_6_9[7:0]};mem[705]<={image_6_9[15:8]};mem[706]<={image_6_9[23:16]};mem[707]<={image_6_9[31:24]};mem[708]<={image_6_9[39:32]};mem[709]<={image_6_9[47:40]};mem[710]<={image_6_9[55:48]};mem[711]<={image_6_9[63:56]};
mem[712]<={image_6_10[7:0]};mem[713]<={image_6_10[15:8]};mem[714]<={image_6_10[23:16]};mem[715]<={image_6_10[31:24]};mem[716]<={image_6_10[39:32]};mem[717]<={image_6_10[47:40]};mem[718]<={image_6_10[55:48]};mem[719]<={image_6_10[63:56]};
mem[720]<={image_6_11[7:0]};mem[721]<={image_6_11[15:8]};mem[722]<={image_6_11[23:16]};mem[723]<={image_6_11[31:24]};mem[724]<={image_6_11[39:32]};mem[725]<={image_6_11[47:40]};mem[726]<={image_6_11[55:48]};mem[727]<={image_6_11[63:56]};
mem[728]<={image_6_12[7:0]};mem[729]<={image_6_12[15:8]};mem[730]<={image_6_12[23:16]};mem[731]<={image_6_12[31:24]};mem[732]<={image_6_12[39:32]};mem[733]<={image_6_12[47:40]};mem[734]<={image_6_12[55:48]};mem[735]<={image_6_12[63:56]};
mem[736]<={image_6_13[7:0]};mem[737]<={image_6_13[15:8]};mem[738]<={image_6_13[23:16]};mem[739]<={image_6_13[31:24]};mem[740]<={image_6_13[39:32]};mem[741]<={image_6_13[47:40]};mem[742]<={image_6_13[55:48]};mem[743]<={image_6_13[63:56]};
mem[744]<={image_6_14[7:0]};mem[745]<={image_6_14[15:8]};mem[746]<={image_6_14[23:16]};mem[747]<={image_6_14[31:24]};mem[748]<={image_6_14[39:32]};mem[749]<={image_6_14[47:40]};mem[750]<={image_6_14[55:48]};mem[751]<={image_6_14[63:56]};
mem[752]<={image_6_15[7:0]};mem[753]<={image_6_15[15:8]};mem[754]<={image_6_15[23:16]};mem[755]<={image_6_15[31:24]};mem[756]<={image_6_15[39:32]};mem[757]<={image_6_15[47:40]};mem[758]<={image_6_15[55:48]};mem[759]<={image_6_15[63:56]};
mem[760]<={image_6_16[7:0]};mem[761]<={image_6_16[15:8]};mem[762]<={image_6_16[23:16]};mem[763]<={image_6_16[31:24]};mem[764]<={image_6_16[39:32]};mem[765]<={image_6_16[47:40]};mem[766]<={image_6_16[55:48]};mem[767]<={image_6_16[63:56]};
mem[768]<={image_7_1[7:0]};mem[769]<={image_7_1[15:8]};mem[770]<={image_7_1[23:16]};mem[771]<={image_7_1[31:24]};mem[772]<={image_7_1[39:32]};mem[773]<={image_7_1[47:40]};mem[774]<={image_7_1[55:48]};mem[775]<={image_7_1[63:56]};
mem[776]<={image_7_2[7:0]};mem[777]<={image_7_2[15:8]};mem[778]<={image_7_2[23:16]};mem[779]<={image_7_2[31:24]};mem[780]<={image_7_2[39:32]};mem[781]<={image_7_2[47:40]};mem[782]<={image_7_2[55:48]};mem[783]<={image_7_2[63:56]};
mem[784]<={image_7_3[7:0]};mem[785]<={image_7_3[15:8]};mem[786]<={image_7_3[23:16]};mem[787]<={image_7_3[31:24]};mem[788]<={image_7_3[39:32]};mem[789]<={image_7_3[47:40]};mem[790]<={image_7_3[55:48]};mem[791]<={image_7_3[63:56]};
mem[792]<={image_7_4[7:0]};mem[793]<={image_7_4[15:8]};mem[794]<={image_7_4[23:16]};mem[795]<={image_7_4[31:24]};mem[796]<={image_7_4[39:32]};mem[797]<={image_7_4[47:40]};mem[798]<={image_7_4[55:48]};mem[799]<={image_7_4[63:56]};
mem[800]<={image_7_5[7:0]};mem[801]<={image_7_5[15:8]};mem[802]<={image_7_5[23:16]};mem[803]<={image_7_5[31:24]};mem[804]<={image_7_5[39:32]};mem[805]<={image_7_5[47:40]};mem[806]<={image_7_5[55:48]};mem[807]<={image_7_5[63:56]};
mem[808]<={image_7_6[7:0]};mem[809]<={image_7_6[15:8]};mem[810]<={image_7_6[23:16]};mem[811]<={image_7_6[31:24]};mem[812]<={image_7_6[39:32]};mem[813]<={image_7_6[47:40]};mem[814]<={image_7_6[55:48]};mem[815]<={image_7_6[63:56]};
mem[816]<={image_7_7[7:0]};mem[817]<={image_7_7[15:8]};mem[818]<={image_7_7[23:16]};mem[819]<={image_7_7[31:24]};mem[820]<={image_7_7[39:32]};mem[821]<={image_7_7[47:40]};mem[822]<={image_7_7[55:48]};mem[823]<={image_7_7[63:56]};
mem[824]<={image_7_8[7:0]};mem[825]<={image_7_8[15:8]};mem[826]<={image_7_8[23:16]};mem[827]<={image_7_8[31:24]};mem[828]<={image_7_8[39:32]};mem[829]<={image_7_8[47:40]};mem[830]<={image_7_8[55:48]};mem[831]<={image_7_8[63:56]};
mem[832]<={image_7_9[7:0]};mem[833]<={image_7_9[15:8]};mem[834]<={image_7_9[23:16]};mem[835]<={image_7_9[31:24]};mem[836]<={image_7_9[39:32]};mem[837]<={image_7_9[47:40]};mem[838]<={image_7_9[55:48]};mem[839]<={image_7_9[63:56]};
mem[840]<={image_7_10[7:0]};mem[841]<={image_7_10[15:8]};mem[842]<={image_7_10[23:16]};mem[843]<={image_7_10[31:24]};mem[844]<={image_7_10[39:32]};mem[845]<={image_7_10[47:40]};mem[846]<={image_7_10[55:48]};mem[847]<={image_7_10[63:56]};
mem[848]<={image_7_11[7:0]};mem[849]<={image_7_11[15:8]};mem[850]<={image_7_11[23:16]};mem[851]<={image_7_11[31:24]};mem[852]<={image_7_11[39:32]};mem[853]<={image_7_11[47:40]};mem[854]<={image_7_11[55:48]};mem[855]<={image_7_11[63:56]};
mem[856]<={image_7_12[7:0]};mem[857]<={image_7_12[15:8]};mem[858]<={image_7_12[23:16]};mem[859]<={image_7_12[31:24]};mem[860]<={image_7_12[39:32]};mem[861]<={image_7_12[47:40]};mem[862]<={image_7_12[55:48]};mem[863]<={image_7_12[63:56]};
mem[864]<={image_7_13[7:0]};mem[865]<={image_7_13[15:8]};mem[866]<={image_7_13[23:16]};mem[867]<={image_7_13[31:24]};mem[868]<={image_7_13[39:32]};mem[869]<={image_7_13[47:40]};mem[870]<={image_7_13[55:48]};mem[871]<={image_7_13[63:56]};
mem[872]<={image_7_14[7:0]};mem[873]<={image_7_14[15:8]};mem[874]<={image_7_14[23:16]};mem[875]<={image_7_14[31:24]};mem[876]<={image_7_14[39:32]};mem[877]<={image_7_14[47:40]};mem[878]<={image_7_14[55:48]};mem[879]<={image_7_14[63:56]};
mem[880]<={image_7_15[7:0]};mem[881]<={image_7_15[15:8]};mem[882]<={image_7_15[23:16]};mem[883]<={image_7_15[31:24]};mem[884]<={image_7_15[39:32]};mem[885]<={image_7_15[47:40]};mem[886]<={image_7_15[55:48]};mem[887]<={image_7_15[63:56]};
mem[888]<={image_7_16[7:0]};mem[889]<={image_7_16[15:8]};mem[890]<={image_7_16[23:16]};mem[891]<={image_7_16[31:24]};mem[892]<={image_7_16[39:32]};mem[893]<={image_7_16[47:40]};mem[894]<={image_7_16[55:48]};mem[895]<={image_7_16[63:56]};
mem[896]<={image_8_1[7:0]};mem[897]<={image_8_1[15:8]};mem[898]<={image_8_1[23:16]};mem[899]<={image_8_1[31:24]};mem[900]<={image_8_1[39:32]};mem[901]<={image_8_1[47:40]};mem[902]<={image_8_1[55:48]};mem[903]<={image_8_1[63:56]};
mem[904]<={image_8_2[7:0]};mem[905]<={image_8_2[15:8]};mem[906]<={image_8_2[23:16]};mem[907]<={image_8_2[31:24]};mem[908]<={image_8_2[39:32]};mem[909]<={image_8_2[47:40]};mem[910]<={image_8_2[55:48]};mem[911]<={image_8_2[63:56]};
mem[912]<={image_8_3[7:0]};mem[913]<={image_8_3[15:8]};mem[914]<={image_8_3[23:16]};mem[915]<={image_8_3[31:24]};mem[916]<={image_8_3[39:32]};mem[917]<={image_8_3[47:40]};mem[918]<={image_8_3[55:48]};mem[919]<={image_8_3[63:56]};
mem[920]<={image_8_4[7:0]};mem[921]<={image_8_4[15:8]};mem[922]<={image_8_4[23:16]};mem[923]<={image_8_4[31:24]};mem[924]<={image_8_4[39:32]};mem[925]<={image_8_4[47:40]};mem[926]<={image_8_4[55:48]};mem[927]<={image_8_4[63:56]};
mem[928]<={image_8_5[7:0]};mem[929]<={image_8_5[15:8]};mem[930]<={image_8_5[23:16]};mem[931]<={image_8_5[31:24]};mem[932]<={image_8_5[39:32]};mem[933]<={image_8_5[47:40]};mem[934]<={image_8_5[55:48]};mem[935]<={image_8_5[63:56]};
mem[936]<={image_8_6[7:0]};mem[937]<={image_8_6[15:8]};mem[938]<={image_8_6[23:16]};mem[939]<={image_8_6[31:24]};mem[940]<={image_8_6[39:32]};mem[941]<={image_8_6[47:40]};mem[942]<={image_8_6[55:48]};mem[943]<={image_8_6[63:56]};
mem[944]<={image_8_7[7:0]};mem[945]<={image_8_7[15:8]};mem[946]<={image_8_7[23:16]};mem[947]<={image_8_7[31:24]};mem[948]<={image_8_7[39:32]};mem[949]<={image_8_7[47:40]};mem[950]<={image_8_7[55:48]};mem[951]<={image_8_7[63:56]};
mem[952]<={image_8_8[7:0]};mem[953]<={image_8_8[15:8]};mem[954]<={image_8_8[23:16]};mem[955]<={image_8_8[31:24]};mem[956]<={image_8_8[39:32]};mem[957]<={image_8_8[47:40]};mem[958]<={image_8_8[55:48]};mem[959]<={image_8_8[63:56]};
mem[960]<={image_8_9[7:0]};mem[961]<={image_8_9[15:8]};mem[962]<={image_8_9[23:16]};mem[963]<={image_8_9[31:24]};mem[964]<={image_8_9[39:32]};mem[965]<={image_8_9[47:40]};mem[966]<={image_8_9[55:48]};mem[967]<={image_8_9[63:56]};
mem[968]<={image_8_10[7:0]};mem[969]<={image_8_10[15:8]};mem[970]<={image_8_10[23:16]};mem[971]<={image_8_10[31:24]};mem[972]<={image_8_10[39:32]};mem[973]<={image_8_10[47:40]};mem[974]<={image_8_10[55:48]};mem[975]<={image_8_10[63:56]};
mem[976]<={image_8_11[7:0]};mem[977]<={image_8_11[15:8]};mem[978]<={image_8_11[23:16]};mem[979]<={image_8_11[31:24]};mem[980]<={image_8_11[39:32]};mem[981]<={image_8_11[47:40]};mem[982]<={image_8_11[55:48]};mem[983]<={image_8_11[63:56]};
mem[984]<={image_8_12[7:0]};mem[985]<={image_8_12[15:8]};mem[986]<={image_8_12[23:16]};mem[987]<={image_8_12[31:24]};mem[988]<={image_8_12[39:32]};mem[989]<={image_8_12[47:40]};mem[990]<={image_8_12[55:48]};mem[991]<={image_8_12[63:56]};
mem[992]<={image_8_13[7:0]};mem[993]<={image_8_13[15:8]};mem[994]<={image_8_13[23:16]};mem[995]<={image_8_13[31:24]};mem[996]<={image_8_13[39:32]};mem[997]<={image_8_13[47:40]};mem[998]<={image_8_13[55:48]};mem[999]<={image_8_13[63:56]};
mem[1000]<={image_8_14[7:0]};mem[1001]<={image_8_14[15:8]};mem[1002]<={image_8_14[23:16]};mem[1003]<={image_8_14[31:24]};mem[1004]<={image_8_14[39:32]};mem[1005]<={image_8_14[47:40]};mem[1006]<={image_8_14[55:48]};mem[1007]<={image_8_14[63:56]};
mem[1008]<={image_8_15[7:0]};mem[1009]<={image_8_15[15:8]};mem[1010]<={image_8_15[23:16]};mem[1011]<={image_8_15[31:24]};mem[1012]<={image_8_15[39:32]};mem[1013]<={image_8_15[47:40]};mem[1014]<={image_8_15[55:48]};mem[1015]<={image_8_15[63:56]};
mem[1016]<={image_8_16[7:0]};mem[1017]<={image_8_16[15:8]};mem[1018]<={image_8_16[23:16]};mem[1019]<={image_8_16[31:24]};mem[1020]<={image_8_16[39:32]};mem[1021]<={image_8_16[47:40]};mem[1022]<={image_8_16[55:48]};mem[1023]<={image_8_16[63:56]};
我做的课设是贪吃蛇,在不同周期内给image赋值可以显示相应部件
效果视频
工程源码
如果读者想试试本文中的代码的话记得先给给mem或image用initial语句赋值