From: adam Date: Fri, 16 Feb 2007 17:56:57 +0000 (+0100) Subject: fix sign-extension bug, add test X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=0926aa3a338496e9c611ee45ea7d8f33272c2952;p=fleet.git fix sign-extension bug, add test --- diff --git a/ships/Iscratch.ship b/ships/Iscratch.ship index 4d89911..267ff17 100644 --- a/ships/Iscratch.ship +++ b/ships/Iscratch.ship @@ -190,12 +190,12 @@ module iscratch (clk, end 2: begin dhorn_full <= 1; - `packet_data(dhorn_d) <= command[23:0]; + `packet_data(dhorn_d) <= { {(`DATAWIDTH-24){command[23]}}, command[23:0] }; `packet_dest(dhorn_d) <= command[34:24]; end 3: begin dhorn_full <= 1; - `packet_data(dhorn_d) <= command[23:0] + current_instruction_read_from; + `packet_data(dhorn_d) <= { {(`DATAWIDTH-24){command[23]}}, command[23:0] } + current_instruction_read_from; `packet_dest(dhorn_d) <= command[34:24]; end endcase diff --git a/tests/literals/negative-absolute-literals.fleet b/tests/literals/negative-absolute-literals.fleet new file mode 100644 index 0000000..5428482 --- /dev/null +++ b/tests/literals/negative-absolute-literals.fleet @@ -0,0 +1,7 @@ +#expect -1 +#ship debug : Debug + +-1: sendto debug.in; +debug.in: take, deliver; + +