自动跟踪源代码中变量的使用

发布于 2024-10-17 08:29:10 字数 425 浏览 6 评论 0原文

我正在使用一组语音处理例程(用 C 编写),旨在使用 MATLAB 上的 mex 命令进行编译。我对使用 FPGA 加速的 C 函数很感兴趣。

硬件通过输入端口接收指定的输入参数,其余输入作为要硬编码的常量,并将 C 函数内的某个特定变量(例如 foo)传递到输出端口。

我有兴趣跟踪 foo 的计算图(不确定这是否是正确的术语)。即 foo 如何与中间计算变量相关,而中间计算变量最终又取决于输入参数和硬编码常量。这是为了让我能够扁平化逻辑,以便可以使用硬件描述语言对其进行编码,并删除不影响 foo 值的不相关逻辑。问题是一些中间变量是全局的,因此跟踪是一个令人头痛的问题。

是否有一个自动化工具可以分析给定的一组 C 头文件和源文件,并提供一种跟踪指定变量如何更改的方法,以及所使用的所有变量的某种依赖关系图?

I'm working with a set of speech processing routines (written in C) meant to be compiled with the mex command on MATLAB. There is this C-function which I'm interested in accelerating using FPGA.

The hardware takes in specified input parameters through input ports, the rest of the inputs as constants to be hard coded, and passes a particular variable some where within the C-function, say foo, to the output port.

I am interested in tracing the computation graph (unsure if this is the right term to use) of foo. i.e. how foo relates to intermediate computed variables, which in turn eventually depends on input parameters and hard coded constants. This is to allow me to flatten the logic so they can be coded using a hardware description language, as well as remove irrevelant logic which does not affect the value of foo. The catch is that some intermediate variables are global, therefore tracing is a headache.

Is there an automated tool which analyzes a given set of C headers and source files and provide a means of tracing how a specified variable is altered, with some kind of dependency graph of all variables used?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木緿 2024-10-24 08:29:10

我认为您正在寻找的是一种进行价值分析的工具。

在可用于执行此操作的工具中,我认为 Code Surfer 可能是最好的那里。当然,它也相当昂贵,但如果您是学生,他们确实有学术许可计划。在开源方面,Frama-C 也可以以更有限的方式做到这一点,并且有很多,更陡峭的学习曲线。但它是免费的,并且可以带你去你想去的地方。

I think what you are looking for is a tool to do value analysis.

Among the tools available to do this, I think Code Surfer is probably the best out there. Of course, it is also quite expensive but if you are a student, they do have an academic license program. On the open-source side, Frama-C can also do this in a more limited fashion and has a much, much steeper learning curve. But it is free and will get you where you want to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文