我想分析组合数字电路。根据以下格式,ASCII文件包含电路的描述:

<name> <logic gate> <inputs> <outputs> <input 1>…<last input> <output> <delay>

在哪里:<name> 是一个不超过20个字符的字符串,带有逻辑门名称。<logic gate> 是一个不超过20个字符的字符串,可以识别逻辑门的类型。有可能 INPUT, OUTPUT, AND, OR, NOT. <inputs> 对于输入等于0的整数等于0,对于不或输出为1,2 for and and和of。<outputs> 对于输出的整数等于0,或者GRETER等于0。<input 1>, <last input>, <output>是每个符号不超过20个字符的字符串,它标识了逻辑门的输入/输出网的名称。<delay> 是确定逻辑门计算其函数所需的时间。

该程序在读取包含电路描述的文件后必须计算电路的关键路径,该路径可以定义为将类型输入门连接到类型输出之一的路径,该路径的延迟之和在其中在路径中,在电路中所有可能的路径中是最高的。

Can anyone please tell me the data structures that are best suited for storing the information the program has to elaborate.
How could i load the the data structure into the memory?

例子

A INPUT 0 1 net1 1
B INPUT 0 1 net2 1
C INPUT 0 1 net3 1
G1 NOT 1 1 net1 net4 1
G2 OR 2 1 met3 net4 net5 1
G3 AND 2 1 net4 net2 net6 2
G4 AND 2 1 net6 net5 net7 2
D OUTPUT 1 0 net6 1
E OUTPUT 1 0 E 1 



In this example the critical path is A/G1/G2/G4/E with a delay of 7.

我该如何植入它?

有帮助吗?

解决方案

如果我正确理解您的问题,您真的很想知道您应该使用哪种算法来计算关键路径。这似乎类似于“最短路径是什么?” - 问题类型。我建议 Dijkstra的算法 对于这个问题。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top