From 0926aa3a338496e9c611ee45ea7d8f33272c2952 Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 16 Feb 2007 18:56:57 +0100 Subject: [PATCH] fix sign-extension bug, add test --- ships/Iscratch.ship | 4 ++-- tests/literals/negative-absolute-literals.fleet | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/literals/negative-absolute-literals.fleet 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; + + -- 1.7.10.4