esl-epfl / x-heep

eXtendable Heterogeneous Energy-Efficient Platform based on RISC-V
Other
141 stars 75 forks source link

extend the sign of the dest data in DMA #498

Closed LuigiGiuffrida98 closed 3 months ago

LuigiGiuffrida98 commented 5 months ago

This PR is to implement sign extension capability in the DMA data transfer if the data type of the destination is wider than the data type of the source.

This required the addition of little logic in the DMA and three control registers:

TODO:

LuigiGiuffrida98 commented 3 months ago

@JuanSapriza, I modified the DMA HAL and the example_dma application, can you please review them?

JuanSapriza commented 3 months ago

To simulate example_dma we need mora than 2 memory banks (the default). We should do something about that or the tests are going to fail. How was it being done before this? :thinking:

Well... it seems that since this change the mcu-gen is done properly with more banks for both the test_all script and the CI... yet we have this situation where it does not work for certain applications. @davideschiavone now that we have this, do you think we could have some sort of "description" at the top of applications that a script can parse and detect if you have the right configuration to do so and give a proper message?

for example, something like

// Copyright EPFL contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

@mcu-mem-banks 8
@mcu-mem-bank-il 2
@mcu-cpu cv32e40p 

#include <stdio.h>
...

Then you run

make mcu-gen
make verilator-sim
make run-app-verilator PROJECT=my_project

> ERROR: You need 8 memory banks. You have generated 2 memory banks. Call make mcu-gen MEM_BANKS=8.   

This should go to another issue... just thinking out loud

JuanSapriza commented 3 months ago

Apart from that, all tests passed. I will check the rest of the code for blasphemies

JuanSapriza commented 3 months ago

I took the liberty of changing a few words, but everything looks amazing. Also tested example_dma_2d and example_dma_external and both return SUCCESS.

✅ Good to merge on my side