我在AES的Verilog代码中找到了以下代码片段。
function [7:0] xtime;
input [7:0] b; xtime={b[6:0],1'b0}^(8'h1b&{8{b[7]}});
endfunction
请解释这是做什么的。解释越详尽越好。
b是8位输入。
b [6:0],1'b0最后7位左移,并用0填充
^ xor
8'h1b 8位十六进制1b与符号位相加。
一行说明:如果将msb设置为与0x1b的异或,则仅* 2
快速搜索xtime和AES会使我想到此c实现的注释:
// xtime is a macro that finds the product of {02} and the argument to
// xtime modulo {1b}
#define xtime(x) ((x<<1) ^ (((x>>7) & 1) * 0x11b))
看起来它可能在做同样的事情。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句