差别
这里会显示出您选择的修订版和当前版本之间的差别。
|
移动位运算符 [2018/09/11 09:11] group001 创建 |
移动位运算符 [2018/09/11 13:09] (当前版本) group001 |
||
|---|---|---|---|
| 行 2: | 行 2: | ||
| 在 Verilog 中有两种移位运算符:左移位运算符和右移位运算符,这两种移位运算符都用 0来填补移出的空位。如下。{{ ::移位运算符.png?400 |}} | 在 Verilog 中有两种移位运算符:左移位运算符和右移位运算符,这两种移位运算符都用 0来填补移出的空位。如下。{{ ::移位运算符.png?400 |}} | ||
| \\ | \\ | ||
| + | <code verilog> | ||
| + | |||
| + | 例子:<<操作。 | ||
| + | //In this example, the reg result is assigned the binary value 0100, | ||
| + | // which is 0001 shifted to the left two positions and zero-filled. | ||
| + | module shift; | ||
| + | reg [3:0] start, result; | ||
| + | initial begin | ||
| + | start = 1; | ||
| + | result = (start << 2); | ||
| + | end | ||
| + | endmodule | ||
| + | |||
| + | </code> | ||