- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm a beginner in FPGA, working on Stratix III DE3 340.
I got a set of serial data, converted it into parallel form, and now I need to write the output of a deserialiser into memory (for processing later). How do I begin? Is there some kind of megafunction for this?Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The exact answer depends on the details of your system, but assuming you're getting one bit at a time and just want to store them in blockram, then by far the simplest is to use the fact that you can use different bit widths for the two different ports. Eg, you can have one be 1 bit wide and read it out 16-bit at a time on the other.
In the more general case, you can accumulate the bits in a shift register and every time you have collected a word worth of data, you write it to memory. Untested example code (not production code, but written for illustration):module memory(
input clock,
input serial_in,
input serial_valid,
input read_address,
output reg read_data);
reg word;
reg bits_collected = 0;
reg bits = 0;
reg write_address = 0;
always @(posedge clock) begin
read_data <= word;
if (serial_valid) begin
bits <= {serial_in, bits}; // lowest bit first
bits_collected <= bits_collected + 1;
if (bits_collected == 32) begin
word <= bits;
write_address <= write_address + 1;
bits_collected <= 1;
end
end
endmodule
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page