blob: 23b222f4658592203f803e00595d4d6b621dc3b1 (
plain)
1
2
3
4
5
6
7
8
9
10
|
val BigEndianReverse : forall ('width : Int), 'width >= 0 & 'width >= 0.
bits('width) -> bits('width) effect {escape}
function BigEndianReverse value_name = {
assert(('width == 8) | (('width == 16) | (('width == 32) | (('width == 64) | ('width == 128)))));
result : bits('width) = replicate_bits(0b0,'width);
foreach (i from 0 to ('width - 1) by 8)
result[i+7 .. i] = (value_name['width-i - 1 .. 'width-i - 8] : bits(8));
return result
}
|