mrflibble
Advanced Member level 5
- Joined
- Apr 19, 2010
- Messages
- 2,720
- Helped
- 679
- Reputation
- 1,360
- Reaction score
- 652
- Trophy points
- 1,393
- Activity points
- 19,551
In the read clock cycle you will still read word{15:8} and word{7:0} together. So you will read aabb in the first clock cycle.
(changed [ ] to { } to workaround curious forum curiousness)
So what? You read out the entire 16-bit wide word from your fifo on the read end. And then you cleverly name the upper 8-bit part_a, and the lower 8-bits part_b. And then in the module AFTER that you process it byte-wise again. So you do a tic-toc. Handle part_a. handle part_b, handle part_a, etc. Obviously the clock at the read side has to be sufficiently high so there are no fifo overflows. But you know that ofcourse, since you know the data rates in your design.
Main issue to resolve here is that the 16 bit data should be separated into 8 bits each so that in every read clock cycle 8 bit data should be processed. Do you agree? Can you please let me know how it should be taken care?
You read out the entire 16-bit wide word from your fifo on the read end. And then you cleverly name the upper 8-bit part_a, and the lower 8-bits part_b. And then in the module AFTER that you process it byte-wise again. So you do a tic-toc. Handle part_a. handle part_b, handle part_a, etc. Obviously the clock at the read side has to be sufficiently high so there are no fifo overflows. But you know that ofcourse, since you know the data rates in your design.
Would you be happy if you had 1 byte each clock cycle? yes or yes? Yes? Excellent.
Would this suddenly solve the problem? If yes, I have some IP I can sell you that will solve this complex design problem.
It is still absolutely unclear why you can't read one byte at a time instead of two if you use the proper fifo. If for some bizarre reason you HAVE TO read two bytes at a time, then you can use a multiplexer to extract one byte at a time. This multiplexer would have to run at twice the clock rate of your read clock.
In the above posts I mentioned many times that I did not want to pack them. It had to be packed to transfer the data from write domain to read domain. I do not want to use aabb. I want to use aa in first clock cycle and bb in next clock cycle.
Can you provide a way to unpack them?
In the read clock cycle you will still read word[15:8] and word[7:0] together. So you will read aabb in the first clock cycle.
Let me clarify the issue more. Suppose the data that is being written in FIFO is a movie which will consist of many images. The movie is processed in a digital system (named System_A) running at a clock named wr_clk. Now there is a need to process some portions of this movie in another digital system (System_B) which can increase the display capability and this digital system runs at a clock named rd_clk. So we transferred the data from the System_A to System_B by using a FIFO and it resulted in the output being aabb, ccdd instead of aa, bb, cc, dd. Now in write side first data is aa (let it be the image of a finger of the palm) and bb (let it be the image of a leg of a man). So when aabb is being processed in System_B it is processing an unwanted image containing finger and leg together. We want the finger to be processed first and then the leg to be processed next in System_B. This is corrupting the image as per clock cycle you are getting aabb, ccdd and they are being processed in System_B.
Regards
Yes, you are right here. This is what wanted and stated again and again.
Dunno, some parts of your problem description are too vague to know for sure. (*) What I can say for certain is that I have solved it in practice in the way I described it.Have you ever solved in practice the issue in the way I am describing?
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 module fix_complex_problem_of_16in_8out( input clock, input [15:0] din, output reg [7:0] dout ); reg byte_sel = 0; always @(posedge clock) begin byte_sel <= ~byte_sel; dout <= (byte_sel) ? din[15:8] : din[7:0]; // THIS MUX. This one. This right here is a 2-to-1 MUX. For context, see below. :P end endmodule // ... and then you instantiate this like so wire [7:0] new_spiffy_1_byte_result_that_your_following_processing_can_use; fix_complex_problem_of_16in_8out fix_complex_problem_of_16in_8out ( .clock (your_fifo_READ_clock), .din (your_aabb_16_bit_data_OUTPUT_from_your_fifo), .dout (new_spiffy_1_byte_result_that_your_following_processing_can_use) ); // And then feed this 8-bit "new_spiffy_1_byte_result_that_your_following_processing_can_use" signal to // whatever processing you need.
Good, then at least we are talking about roughly the same thing.
Dunno, some parts of your problem description are too vague to know for sure. (*) What I can say for certain is that I have solved it in practice in the way I described it.
(*)Yes yes, you may think you have stated things clearly. Judging by the replies in this thread several people beg to differ. Me included.
Anyways, you can use something along these lines.
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 module fix_complex_problem_of_16in_8out( input clock, input [15:0] din, output reg [7:0] dout ); reg byte_sel = 0; always @(posedge clock) begin byte_sel <= ~byte_sel; dout <= (byte_sel) ? din[15:8] : din[7:0]; // THIS MUX. This one. This right here is a 2-to-1 MUX. For context, see below. :P end endmodule // ... and then you instantiate this like so wire [7:0] new_spiffy_1_byte_result_that_your_following_processing_can_use; fix_complex_problem_of_16in_8out fix_complex_problem_of_16in_8out ( .clock (your_fifo_READ_clock), .din (your_aabb_16_bit_data_OUTPUT_from_your_fifo), .dout (new_spiffy_1_byte_result_that_your_following_processing_can_use) ); // And then feed this 8-bit "new_spiffy_1_byte_result_that_your_following_processing_can_use" signal to // whatever processing you need.
Obviously there is work required on your part. I only give you some idea on you could approach things. One thing I conveniently and happily ignored due to lack of details provided, is things like fifo being empty/full/whatever. But since you know the specifics of your fifo I am sure you can incorporate that. If you need another MSB/LSB order then you can just change the MUX. What MUX you ask? I'll retro-actively mark it in the code up there.
What you still have to do yourself is read from the fifo on only the even cycles. I'd give you some code for it, but lack of details of your fifo enables my laziness.
Good luck!
You keep refusing to answer a fundamental question: WHY CAN'T YOU USE A FIFO WITH AN 8 BIT WIDE OUTPUT??????
I got the answer now. So it is clear that my query which has been answered is clear. I did not mention many related issue in this thread like FIFO size etc because I did not have any query related to that. Thanks for the answer and replies.
I have another issue now to look at: The FIFO is 8 bit wide. How can I extract 16 bit out of the FIFO in one read clock cycle?
And you are sure you are not trolling?Anyways, I am sure that with the previous answer you will manage to figure it out. What with your clear query having been answered. In fact the query was so clear it only took 29 posts for you to get an answer to this clear question that some might consider digital design 101.
You are absolutely right. This had nothing to do with your vague descriptions. I am certain it must have been all those other people on a mission to misunderstand things. Well, glad we got that sorted out. You are well on your way to solve your other remaining issue in no time. Looking forward to reading about the solution in post 58!
No inconvience whatsover, don't worry. I got to practice my sarcasm skills, so that's all good. Apparently I need the practice...
And your second query is tip top crystal clear. I am confident you shall arrive at a solution, possibly even before post 58. Good luck!
What is your answer to my second query? I do not understand why you want the sacasm skills in you. It may spoil your replationship with others. Anyway this is not my business.
We are not supposed to discuss this issue in thread.
I shouldn't even bother answering anymore because you seem to think that your lack of clarity is everyone else's fault. But:
You can't extract 16 bits of data out of an 8-bit wide fifo in a single clock cycle- that would make it a
16 BIT WIDE FIFO!!!!!!
This just seems to be the reverse of your original problem.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?