Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

640 byte Line Buffer

Status
Not open for further replies.

stark43

Member level 1
Joined
Oct 24, 2021
Messages
35
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
387
Hello,
I want to serialize 640 byte pixel data and I used line buffer for this and when I looked at the schematic I got scared and I think I made a mistake. Are there any nicer ways to save 640 bytes into memory? Sorry for my inexperience.
 

Attachments

  • Capture.PNG
    Capture.PNG
    39.1 KB · Views: 122
  • Capture2.PNG
    Capture2.PNG
    11.9 KB · Views: 128
  • Capture3.PNG
    Capture3.PNG
    21.2 KB · Views: 109
  • Capture4.PNG
    Capture4.PNG
    22.5 KB · Views: 115
  • Capture5.PNG
    Capture5.PNG
    24.5 KB · Views: 108
  • Capture6.PNG
    Capture6.PNG
    39.5 KB · Views: 113
  • line_buffer.txt
    1.3 KB · Views: 140
  • serializer_.txt
    2.4 KB · Views: 133

Hello,
I want to serialize 640 byte pixel data and I used line buffer for this and when I looked at the schematic I got scared and I think I made a mistake. Are there any nicer ways to save 640 bytes into memory? Sorry for my inexperience.
Yes, use an actual memory (probably want to use dual-port) instead of flip-flops. You can infer a memory in RTL but the way you have written the line buffer "memory" does not allow inference of a dual port memory block. Take a look at your synthesis guides from the FPGA vendor to see how you need to write inferred memories. You might also consider using a FIFO instead as you don't appear to be accessing the memory out of sequential order.

You could also improve the final serializer, by using a shift register instead of an FSM and muxing the data to the output.


Code Verilog - [expand]
1
2
always @(posedge clk)
  out <= shift_loadn ? {out[6:0], 1'b0} : din;


out[7] is the serial output data
din is the 8-bit data to serialize
shift_loadn would be controlled by an FSM/counter logic
  1. load would be active at c0 (loads din, out[7] is din[7])
  2. shift would be active from c1-c7 (shifts din[6] to out[7], din[5]....din[0])
  3. repeat starting a 1.
Using a shift register like this will require less logic and will be capable of running at much higher clock frequencies.
 
You're right, I really stretched the job. I have a problem. With your permission, I would like to summarize the case for you. I am interested in MIPI CSI-2 and I want to serialize it by adding some packets to parallel pixels in the simplest way without using any IP. I have a block transmitting pixels in my camera (640x512) and I convert those pixels from pixel to byte layer bytes and then save them to the buffer. Then, when prompted, I need to serially output the bytes converted by the serializer module. I'm just confused about the sync issue.
1) I want to send data as bytes to the serialization module after saving the data to the [639:0] row buffer with each pixel clk. Only the serializer will run at 200Mhz and a transmission will take 8 hours. So if I serialize the data with clk (200Mhz/8) after saving the bytes to the row buffer, will I lose data? Like this;


SVG:
`timescale 1ns / 1ps

module serializer(
input  wire mipi_clk,                  //200Mhz     
input  wire pixel_clk,              //21,04Mhz
input  wire serial_valid ,     
input  wire [7:0] data_in,         
output reg serial_output =0
);


always @(posedge pixel_clk)
begin
    [639:0] line_buffer ---> Data is saved to line buffer
end

always @(posedge (mipi_clk / 8) )
begin
    line_buffer[0,1,2....,639] ---> Serializer
end


always @(posedge mipi_clk)
begin
    line_buffer[0] ---> As you said, we shift the data and give it to the output serially, and this process takes 8 steps.
    line_buffer[1] ---> As you said, we shift the data and give it to the output serially, and this process takes 8 steps.
    .
    .
    .
    line_buffer[639] ---> As you said, we shift the data and give it to the output serially, and this process takes 8 steps.
    
end


endmodule

Does it make sense if I do it this way sir or is the clk/8 idea nonsense? Or if I set up a combinational structure and want it to enter the serialization process as the data comes in, I think I should do it like this;

SVG:
always @(data_in)
begin
    serialization
end

But if the same data comes in this way, I doubt that it will enter this block because there will be no change in the data. I would be very happy if you could give an idea how I can run an algorithm or logic.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top