change size of pic
This commit is contained in:
parent
2d29d809f5
commit
909efb3bd6
|
@ -1,2 +1,4 @@
|
||||||
/CFA/sim/**
|
/CFA/sim/**
|
||||||
!/CFA/sim/demosaic.v
|
!/CFA/sim/demosaic.v
|
||||||
|
.idea/
|
||||||
|
!/CFA/sim/transform/**
|
|
@ -1,27 +1,34 @@
|
||||||
module demosaic(clk, reset, in_en, data_in, wr_r, addr_r, wdata_r, rdata_r, wr_g, addr_g, wdata_g, rdata_g, wr_b, addr_b, wdata_b, rdata_b, done);
|
module demosaic #(
|
||||||
input clk;
|
parameter IM_WIDTH = 512,
|
||||||
input reset;
|
parameter IM_HEIGHT = 256
|
||||||
input in_en;
|
)(
|
||||||
input [7:0] data_in;
|
input clk,
|
||||||
output reg wr_r;
|
input reset,
|
||||||
output reg [13:0] addr_r;
|
input in_en,
|
||||||
output reg [7:0] wdata_r;
|
input [7:0] data_in,
|
||||||
input [7:0] rdata_r;
|
output reg wr_r,
|
||||||
output reg wr_g;
|
output reg [13:0] addr_r,
|
||||||
output reg [13:0] addr_g;
|
output reg [7:0] wdata_r,
|
||||||
output reg [7:0] wdata_g;
|
input [7:0] rdata_r,
|
||||||
input [7:0] rdata_g;
|
output reg wr_g,
|
||||||
output reg wr_b;
|
output reg [13:0] addr_g,
|
||||||
output reg [13:0] addr_b;
|
output reg [7:0] wdata_g,
|
||||||
output reg [7:0] wdata_b;
|
input [7:0] rdata_g,
|
||||||
input [7:0] rdata_b;
|
output reg wr_b,
|
||||||
output reg done;
|
output reg [13:0] addr_b,
|
||||||
|
output reg [7:0] wdata_b,
|
||||||
|
input [7:0] rdata_b,
|
||||||
|
output reg done
|
||||||
|
);
|
||||||
|
|
||||||
|
parameter IM_SIZE = IM_HEIGHT * IM_WIDTH;
|
||||||
|
|
||||||
// Register
|
// Register
|
||||||
reg [1:0] bilinearCase;
|
reg [1:0] bilinearCase;
|
||||||
reg [2:0] state, nextState;
|
reg [2:0] state, nextState;
|
||||||
reg [3:0] counter9;
|
reg [3:0] counter9;
|
||||||
reg [6:0] caseCounter, round;
|
reg [6:0] round;
|
||||||
|
reg [11:0] caseCounter;
|
||||||
reg [7:0] data [8:0];
|
reg [7:0] data [8:0];
|
||||||
reg [7:0] red, blue, green;
|
reg [7:0] red, blue, green;
|
||||||
reg [14:0] counter, biCounter; // bicounter store the center address
|
reg [14:0] counter, biCounter; // bicounter store the center address
|
||||||
|
@ -45,11 +52,11 @@ end
|
||||||
//next state logic
|
//next state logic
|
||||||
always @(*) begin
|
always @(*) begin
|
||||||
case (state)
|
case (state)
|
||||||
READDATA: nextState = (counter == 15'd16384)? COLOR : READDATA;
|
READDATA: nextState = (counter == IM_SIZE)? COLOR : READDATA;
|
||||||
COLOR: nextState = STORE9;
|
COLOR: nextState = STORE9;
|
||||||
STORE9: nextState = (counter9 == 4'd9)? BILINEAR : STORE9;
|
STORE9: nextState = (counter9 == 4'd9)? BILINEAR : STORE9;
|
||||||
BILINEAR: nextState = WRITEDATA;
|
BILINEAR: nextState = WRITEDATA;
|
||||||
WRITEDATA: nextState = (biCounter == 15'd16257)? FINISH : COLOR;
|
WRITEDATA: nextState = (biCounter == ( IM_SIZE - IM_WIDTH + 1 ))? FINISH : COLOR;
|
||||||
FINISH: nextState = FINISH;
|
FINISH: nextState = FINISH;
|
||||||
default: nextState = READDATA;
|
default: nextState = READDATA;
|
||||||
endcase
|
endcase
|
||||||
|
@ -234,7 +241,7 @@ always @(posedge clk or posedge reset) begin
|
||||||
wdata_r <= red;
|
wdata_r <= red;
|
||||||
wdata_g <= green;
|
wdata_g <= green;
|
||||||
wdata_b <= blue;
|
wdata_b <= blue;
|
||||||
if(caseCounter == 7'd126) begin // Finish one row, then initialize the caseCounter
|
if(caseCounter == ( IM_WIDTH - 2 )) begin // Finish one row, then initialize the caseCounter
|
||||||
caseCounter <= 7'd0;
|
caseCounter <= 7'd0;
|
||||||
round <= round + 7'd1;
|
round <= round + 7'd1;
|
||||||
biCounter <= biCounter + 15'd3; // Skip the edge
|
biCounter <= biCounter + 15'd3; // Skip the edge
|
||||||
|
|
Loading…
Reference in New Issue