图像大小为100 * 100
代码的实现过程都一样,也就是地址的初值和递进值不同,较为简单,就直接给出地址改变的相关代码了
左旋转90°
always@(posedge clk_9M or negedge rst) begin if(rst == 1'b0) rom_addr <= 'd0; else if(cur_y > 'd150) rom_addr <= 'd0; else if(active == 1'b1) begin rom_addr <= rom_addr + 'd100; end else rom_addr <= 'd149-cur_y; end
右旋转90°
always@(posedge clk_9M or negedge rst) begin if(rst == 1'b0) rom_addr <= 'd0; else if(cur_y > 'd150) rom_addr <= 'd0; else if(active == 1'b1) begin rom_addr <= rom_addr - 'd100; end else rom_addr <= 'd9900 + (cur_y-'d50); end
水平翻转
always@(posedge clk_9M or negedge rst) begin if(rst == 1'b0) rom_addr <= 'd0; else if(cur_y > 'd150) rom_addr <= 'd0; else if(active == 1'b1) begin rom_addr <= rom_addr + 1'b1; end else rom_addr <= 100 *(149-cur_y); end
公众号:FPGA之旅