# matrix transpose code for Implementation of 2D fft

Status
Not open for further replies.

#### shan14

##### Member level 3
Hi

I am doing 2D fft in VHDL . My algorithm is
1) 1D fft then
2) transpose of the output of 1D fft
3)again 1D ft of those transpose output
4)again transpose the 1D fft

So in this, I am using following matrix transpose code .

My question is that,is this matrix transpose code correct for doing 2D fft???

#### Attachments

• 1.9 KB Views: 11

#### TrickyDicky

Have you made a testbench? That would be the best way to test it.

There is one error in that x is never reset back to 0, so if X overflows the simulation will error.

#### waso

##### Newbie level 3
Hello shan14,

in regards to your code, did you synthesize it successfully? I just copy and paste the code and I got an error due to size mismatch. It is just the size of "t1", you have to set it to 2 downto 0.

From my point of view, there are couple of things I would coded differently. In the process sensitivity list, I would put just the clock signal and reset. I think, maybe you can put the assignation "output_there <= '1'" inside the "elsif(rising_edge(clk)) then".

Also, as TrickyDicky suggested you, a testbench is the best way to test if your design behaves as you expect

Best regards.

##### Super Moderator
Staff member
I am doing 2D fft in VHDL . My algorithm is
1) 1D fft then
2) transpose of the output of 1D fft
3)again 1D ft of those transpose output
4)again transpose the 1D fft
Are you sure this is the correct algorithm? I ran across this method on stackexchange. It seems that the OP changed their code and verified that it worked with the algorithm given by Paul R.

I also don't understand where your input matrix is, the input is just a single vector. Is your data streaming? If so how do you determine where the rows/columns of your matrix are located in the stream?

shan14

### shan14

points: 2

#### shan14

##### Member level 3
Hi

I am taking 16 point FFT. so 16 inputs are coming one by one. I am considering it as a 4*4 matrix.

so while doing transpose of the output of 1D FFT, I am getting transposed output which is correct.

My doubt is that is this way correct??

#### waso

##### Newbie level 3
Hi shan14,

I guess you are using the signal "output_there" to indicate that you have buffered the entire matrix and you are going to output it. So, in my opinion you should add a "start" input port in your design to indicate your block to start receiving each point of the 4*4 matrix, otherwise it considers every input data as matrix data.

After adding the start input port I would say the code is correct.

Anyhow in a sequential process, I would not add any signal at the sensitivity list other than clock and reset. And if possible, in my opinion is a good practice not to have many nested if statements.

Kind regards.

shan14

points: 2