diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2017-01-08 19:33:35 -0600 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2017-01-08 22:02:28 -0600 |
commit | e601b9315384792b82517ba3ab30cee316295558 (patch) | |
tree | 6ec92d0d61c918b057490b12a9d3eca6337bffb2 | |
parent | 8d316df61f4b01b6fcd8ca211faa6cb146127528 (diff) |
add ALU test for shift operations
-rw-r--r-- | alu_tb.v | 8 | ||||
-rw-r--r-- | tests/alu | 24 |
2 files changed, 32 insertions, 0 deletions
@@ -32,6 +32,14 @@ module alu_tb (); "&" : op = 4; "|" : op = 5; "^" : op = 6; + "<<" : op = 8; + "<<1" : op = 9; + "<<-" : op = 10; + "<<<" : op = 11; + ">>" : op = 12; + "1>>" : op = 13; + "->>" : op = 14; + ">>>" : op = 15; default : op = 0; endcase @@ -8,6 +8,14 @@ # & : and # | : or # ^ : xor +# << : left shift extended with zeros +# <<1 : left shift extended with ones +# <<- : left shift extended with least significant bit +# <<< : left rotate +# >> : right shift extended with zeros +# 1>> : right shift extended with ones +# ->> : right shift extended with most significant bit +# >>> : right rotate 0x0123 + 0x1234 = 0x1357 Z=0 C=0 0x0123 - 0x1234 = 0xeeef Z=0 C=1 @@ -17,3 +25,19 @@ 0xaf74 & 0x7cc7 = 0x2c44 Z=0 C=0 0xaf74 | 0x7cc7 = 0xfff7 Z=0 C=0 0xaf74 ^ 0x7cc7 = 0xd3b3 Z=0 C=0 +0xfa0a << 0x01 = 0xf414 Z=0 C=0 +0xfa0a << 0x02 = 0xe828 Z=0 C=0 +0xfa0a >> 0x02 = 0x3e82 Z=0 C=0 +0xfa0a >> 0x04 = 0x0fa0 Z=0 C=0 +0xfa0a << 0x04 = 0xa0a0 Z=0 C=0 +0xfa0a <<1 0x04 = 0xa0af Z=0 C=0 +0xfa0a 1>> 0x04 = 0xffa0 Z=0 C=0 +0xfa0a <<- 0x04 = 0xa0a0 Z=0 C=0 +0xfa0a ->> 0x04 = 0xffa0 Z=0 C=0 +0xfa0a >>> 0x04 = 0xafa0 Z=0 C=0 +0xfa0a <<< 0x04 = 0xa0af Z=0 C=0 +0x0001 <<- 0x0e = 0x7fff Z=0 C=0 +0x0001 <<- 0x10 = 0xffff Z=0 C=0 +0x0001 ->> 0x10 = 0x0000 Z=1 C=0 +0x0001 <<- 0xff = 0xffff Z=0 C=0 +0x0001 ->> 0xff = 0x0000 Z=1 C=0 |