2009-08-08 18 views
1

Specman中有一個reduce()列表方法,我可以使用它來實現一般還原函數嗎?我想的是這樣的:在Specman中減少列表,就像在Python中一樣

var x: list of bit = some_function_that_returns_list_of_bit; 
var bitmap: uint = x.reduce(foo()); 

其中reduce()作品如同在Python:

foo(last: uint, val: bit) is: uint { 
    return (last << 1) | bit; 
}; 

回答

1

的Specman 6.1文檔不表現出減少僞方法。在您的文檔搜索「名單僞法」

bitmap = pack(packing.low, x) 

您可能會發現「減少」在你的Specman的版本僞方法:爲了您的具體例如,您可以acheive你想要什麼。

Section「Math and Logic Pseudo-Methods」顯示了方法and_all(),average(),or_all(),product()和sum()。我知道這不是薈萃的解決方案,但它比咬牙切齒更好。

相關問題