- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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?링크가 복사됨
1 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
