x393  1.0
FPGAcodeforElphelNC393camera
mcntrl_1kx32r.v
Go to the documentation of this file.
1 
40 `timescale 1ns/1ps
41 
43  input ext_clk,
44  input [ 9:0] ext_raddr, // read address
45  input ext_rd, // read port enable
46  input ext_regen, // output register enable
47  output [31:0] ext_data_out, // data out
48 
49  input wclk, // !mclk (inverted)
50  input [1:0] wpage_in, // will register to wclk, input OK with mclk
51  input wpage_set, // set internal read page to rpage_in
52  input page_next, // advance to next page (and reset lower bits to 0)
53  output [1:0] page, // current inernal page
54  input we, // write port enable (also increment write buffer address)
55  input [63:0] data_in // data in
56 );
57  reg [1:0] page_r;
58  reg [6:0] waddr;
59  assign page=page_r;
60  always @ (posedge wclk) begin
61 
62  if (wpage_set) page_r <= wpage_in;
63  else if (page_next) page_r <= page_r+1;
64 
65  if (page_next || wpage_set) waddr <= 0;
66  else if (we) waddr <= waddr+1;
67  end
69  .REGISTERS(1)
70  ) ram_512x64w_1kx32r_i (
71  .rclk (ext_clk), // input
72  .raddr (ext_raddr), // input[9:0]
73  .ren (ext_rd), // input
74  .regen (ext_regen), // input
75  .data_out (ext_data_out), // output[31:0]
76  .wclk (wclk), // input - OK, negedge mclk
77  .waddr ({page,waddr}), // input[8:0] @negedge mclk
78  .we (we), // input @negedge mclk
79  .web (8'hff), // input[7:0]
80  .data_in (data_in) // input[63:0] @negedge mclk
81  );
82 endmodule
83 
[1:0] 5161wpage_in
Definition: mcntrl_1kx32r.v:50
[ 9:0] 5156ext_raddr
Definition: mcntrl_1kx32r.v:44
ram_512x64w_1kx32r_i ram_512x64w_1kx32r
Definition: mcntrl_1kx32r.v:68
5168waddrreg[6:0]
Definition: mcntrl_1kx32r.v:58
[31:0] 5159ext_data_out
Definition: mcntrl_1kx32r.v:47
[1:0] 5164page
Definition: mcntrl_1kx32r.v:53
[63:0] 5166data_in
Definition: mcntrl_1kx32r.v:55
5167page_rreg[1:0]
Definition: mcntrl_1kx32r.v:57