URL
https://opencores.org/ocsvn/openmsp430/openmsp430/trunk
Subversion Repositories openmsp430
Compare Revisions
- This comparison shows the changes necessary to convert path
/openmsp430/trunk/core/sim
- from Rev 65 to Rev 67
- ↔ Reverse comparison
Rev 65 → Rev 67
/rtl_sim/run/run_all_mpy
0,0 → 1,35
#!/bin/sh |
|
# Enable/Disable waveform dumping |
OMSP_NODUMP=1 |
export OMSP_NODUMP |
|
rm -rf *.log |
echo "" |
echo " ====================================================" |
echo "| WARNING: Complete Hardware Multiplier verification |" |
echo "| regression might take several hours. |" |
echo " ====================================================" |
echo "" |
|
# Hardware multiplier test patterns |
../bin/msp430sim mpy_basic | tee mpy_basic.log |
../bin/msp430sim mpy_mpy | tee mpy_mpy.log |
../bin/msp430sim mpy_mpys | tee mpy_mpys.log |
../bin/msp430sim mpy_mac | tee mpy_mac.log |
../bin/msp430sim mpy_macs | tee mpy_macs.log |
|
grep FAILED *.log |
echo "" |
echo " ================================" |
echo -n "| Number of passed patterns: " |
cat *.log | grep -c PASSED |
echo -n "| Number of failed patterns: " |
cat *.log | grep -c FAILED |
echo "|--------------------------------" |
echo -n "| Number of patterns: " |
ls -1 *.log | wc -l |
echo " ================================" |
echo " Make sure passed == total" |
echo "" |
echo "" |
rtl_sim/run/run_all_mpy
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: rtl_sim/run/run
===================================================================
--- rtl_sim/run/run (revision 65)
+++ rtl_sim/run/run (revision 67)
@@ -1,3 +1,7 @@
#!/bin/sh
-../bin/msp430sim dbg_cpu
+# Enable/Disable waveform dumping
+OMSP_NODUMP=0
+export OMSP_NODUMP
+
+../bin/msp430sim mpy_basic
/rtl_sim/run/run_all
82,7 → 82,10
../bin/msp430sim tA_clkmux | tee tA_clkmux.log |
|
|
# Hardware multiplier test patterns |
../bin/msp430sim mpy_basic | tee mpy_basic.log |
|
|
grep FAILED *.log |
echo "" |
echo " ================================" |
/rtl_sim/src/mpy_mpys.s43
0,0 → 1,146
/*===========================================================================*/ |
/* Copyright (C) 2001 Authors */ |
/* */ |
/* This source file may be used and distributed without restriction provided */ |
/* that this copyright statement is not removed from the file and that any */ |
/* derivative work contains the original copyright notice and the associated */ |
/* disclaimer. */ |
/* */ |
/* This source file is free software; you can redistribute it and/or modify */ |
/* it under the terms of the GNU Lesser General Public License as published */ |
/* by the Free Software Foundation; either version 2.1 of the License, or */ |
/* (at your option) any later version. */ |
/* */ |
/* This source is distributed in the hope that it will be useful, but WITHOUT*/ |
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ |
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ |
/* License for more details. */ |
/* */ |
/* You should have received a copy of the GNU Lesser General Public License */ |
/* along with this source; if not, write to the Free Software Foundation, */ |
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ |
/* */ |
/*===========================================================================*/ |
/* HARDWARE MULTIPLIER */ |
/*---------------------------------------------------------------------------*/ |
/* Test the hardware multiplier: */ |
/* - MPYS mode. */ |
/* */ |
/* Author(s): */ |
/* - Olivier Girard, olgirard@gmail.com */ |
/* */ |
/*---------------------------------------------------------------------------*/ |
/* $Rev: 18 $ */ |
/* $LastChangedBy: olivier.girard $ */ |
/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */ |
/*===========================================================================*/ |
|
.global main |
|
.set WDTCTL, 0x0120 |
|
.set MPY, 0x0130 |
.set MPYS, 0x0132 |
.set MAC, 0x0134 |
.set MACS, 0x0136 |
.set OP2, 0x0138 |
.set RESLO, 0x013A |
.set RESHI, 0x013C |
.set SUMEXT, 0x013E |
|
|
main: |
|
/* -------------- SIGNED MULTIPLICATION --------------- */ |
|
;; Disable watchdog |
mov #0x5A80, &WDTCTL |
|
;; Initialize variables |
mov #0x0000, R15 |
mov #0x0000, R8 |
mov #0x0000, R9 |
|
mpy_loop: |
|
;; Initialize RESLO and RESHI to make sure it is overwritten |
mov #0x0000, &RESLO |
mov #0xC000, &RESHI |
|
;; Perform unsigned R8*R9 |
mov R8, &MPYS |
mov R9, &OP2 |
|
;; Read result |
mov &RESLO, R10 |
mov &RESHI, R11 |
mov &SUMEXT, R12 |
|
;; Notify verilog checker |
add #1, R15 |
|
;; Update next OP1 (R8) |
cmp #0xF0F0, R8 |
jeq op2_update |
|
mov #0x00FF, R7 |
and R8, R7 |
cmp #0x00F0, R7 |
jeq op1_hi_update |
|
add #0x0010, R8 |
jmp mpy_loop |
op1_hi_update: |
and #0xff00, R8 |
add #0x1000, R8 |
jmp mpy_loop |
|
|
;; Update next OP2 (R9) |
op2_update: |
cmp #0xF0F0, R9 |
jeq end_of_test |
|
mov #0x0000, R8 |
|
mov #0x00FF, R7 |
and R9, R7 |
cmp #0x00F0, R7 |
jeq op2_hi_update |
|
add #0x0010, R9 |
jmp mpy_loop |
op2_hi_update: |
and #0xff00, R9 |
add #0x1000, R9 |
jmp mpy_loop |
|
|
|
/* ---------------------- END OF TEST --------------- */ |
end_of_test: |
nop |
br #0xffff |
|
|
|
|
/* ---------------------- INTERRUPT VECTORS --------------- */ |
|
.section .vectors, "a" |
.word end_of_test ; Interrupt 0 (lowest priority) <unused> |
.word end_of_test ; Interrupt 1 <unused> |
.word end_of_test ; Interrupt 2 <unused> |
.word end_of_test ; Interrupt 3 <unused> |
.word end_of_test ; Interrupt 4 <unused> |
.word end_of_test ; Interrupt 5 <unused> |
.word end_of_test ; Interrupt 6 <unused> |
.word end_of_test ; Interrupt 7 <unused> |
.word end_of_test ; Interrupt 8 <unused> |
.word end_of_test ; Interrupt 9 <unused> |
.word end_of_test ; Interrupt 10 Watchdog timer |
.word end_of_test ; Interrupt 11 <unused> |
.word end_of_test ; Interrupt 12 <unused> |
.word end_of_test ; Interrupt 13 <unused> |
.word end_of_test ; Interrupt 14 NMI |
.word main ; Interrupt 15 (highest priority) RESET |
rtl_sim/src/mpy_mpys.s43
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/mpy_mac.v
===================================================================
--- rtl_sim/src/mpy_mac.v (nonexistent)
+++ rtl_sim/src/mpy_mac.v (revision 67)
@@ -0,0 +1,87 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MAC mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+`define NO_TIMEOUT
+
+integer i;
+reg [32:0] result;
+
+initial
+ begin
+ $display(" ===============================================");
+ $display("| START SIMULATION |");
+ $display(" ===============================================");
+ repeat(5) @(posedge mclk);
+ stimulus_done = 0;
+ i = 0;
+
+
+ for ( i=0; i < 'h10000; i=i+1)
+ begin
+ @(r15);
+ result = 32'hC000_0000 + (r8*r9);
+ if (r10 !== result[15:0])
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {15'h0000, result[32]}, result[31:16], result[15:0]);
+ tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO =====");
+ end
+ if (r11 !== result[31:16])
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {15'h0000, result[32]}, result[31:16], result[15:0]);
+ tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI =====");
+ end
+ if (r12 !== {15'h0000, result[32]})
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {15'h0000, result[32]}, result[31:16], result[15:0]);
+ tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT =====");
+ end
+
+ if (r15[7:0]==8'h00)
+ $display("OP2 = 0x%h done", r9);
+ end
+
+
+
+ stimulus_done = 1;
+ end
+
rtl_sim/src/mpy_mac.v
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/mpy_basic.s43
===================================================================
--- rtl_sim/src/mpy_basic.s43 (nonexistent)
+++ rtl_sim/src/mpy_basic.s43 (revision 67)
@@ -0,0 +1,668 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MPY mode. */
+/* - MPYS mode. */
+/* - MAC mode. */
+/* - MACS mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+.global main
+
+.set MPY, 0x0130
+.set MPYS, 0x0132
+.set MAC, 0x0134
+.set MACS, 0x0136
+.set OP2, 0x0138
+.set RESLO, 0x013A
+.set RESHI, 0x013C
+.set SUMEXT, 0x013E
+
+
+main:
+
+ /* -------------- UNSIGNED MULTIPLICATION --------------- */
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x3104, &MPY ; 0x3104 * 0x0285 = 0x007B_7F14, ext=0x0000
+ mov #0x0285, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0001, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x0000, &MPY ; 0x0000 * 0x0000 = 0x0000_0000, ext=0x0000
+ mov #0x0000, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0002, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x0001, &MPY ; 0x0001 * 0x0001 = 0x0000_0001, ext=0x0000
+ mov #0x0001, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0003, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x7FFF, &MPY ; 0x7FFF * 0x7FFF = 0x3FFF_0001, ext=0x0000
+ mov #0x7FFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0004, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0xFFFF, &MPY ; 0xFFFF * 0xFFFF = 0xFFFE_0001, ext=0x0000
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0005, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x7FFF, &MPY ; 0x7FFF * 0xFFFF = 0x7FFE_8001, ext=0x0000
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0006, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MPY ; 0x8000 * 0x7FFF = 0x3FFF_8000, ext=0x0000
+ mov #0x7FFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0007, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MPY ; 0x8000 * 0xFFFF = 0x7FFF_8000, ext=0x0000
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0008, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MPY ; 0x8000 * 0x8000 = 0x4000_0000, ext=0x0000
+ mov #0x8000, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0009, R15
+ nop
+ nop
+ nop
+ nop
+
+ /* -------------- SIGNED MULTIPLICATION --------------- */
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x3104, &MPYS ; 0x3104 * 0x8285 = 0xE7F9_7F14, ext=0xFFFF
+ mov #0x8285, &OP2 ; 12548 * -32123
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0001, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x0000, &MPYS ; 0x0000 * 0x0000 = 0x0000_0000, ext=0x0000
+ mov #0x0000, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0002, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x0001, &MPYS ; 0x0001 * 0x0001 = 0x0000_0001, ext=0x0000
+ mov #0x0001, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0003, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x7FFF, &MPYS ; 0x7FFF * 0x7FFF = 0x3FFF_0001, ext=0x0000
+ mov #0x7FFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0004, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0xFFFF, &MPYS ; 0xFFFF * 0xFFFF = 0x0000_0001, ext=0x0000
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0005, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x7FFF, &MPYS ; 0x7FFF * 0xFFFF = 0xFFFF_8001, ext=0xFFFF
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0006, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MPYS ; 0x8000 * 0x7FFF = 0xC000_8000, ext=0xFFFF
+ mov #0x7FFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0007, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MPYS ; 0x8000 * 0xFFFF = 0x0000_8000, ext=0x0000
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0008, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MPYS ; 0x8000 * 0x8000 = 0x4000_0000, ext=0x0000
+ mov #0x8000, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0009, R15
+ nop
+ nop
+ nop
+ nop
+
+ /* -------------- UNSIGNED MULTIPLY-ACCUMULATE --------------- */
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x3104, &MAC ; 0xC000_0000 + (0x3104 * 0x0285) = 0x007B_7F14, ext=0x0000
+ mov #0x0285, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0001, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x0000, &MAC ; 0xC000_0000 + (0x0000 * 0x0000) = 0xC000_0000, ext=0x0000
+ mov #0x0000, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0002, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x0001, &MAC ; 0xC000_0000 + (0x0001 * 0x0001) = 0xC000_0001, ext=0x0000
+ mov #0x0001, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0003, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x7FFF, &MAC ; 0xC000_0000 + (0x7FFF * 0x7FFF) = 0xFFFF_0001, ext=0x0000
+ mov #0x7FFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0004, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0xFFFF, &MAC ; 0xC000_0000 + (0xFFFF * 0xFFFF) = 0xBFFE_0001, ext=0x0001
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0005, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x7FFF, &MAC ; 0xC000_0000 + (0x7FFF * 0xFFFF) = 0x3FFE_8001, ext=0x0001
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0006, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MAC ; 0xC000_0000 + (0x8000 * 0x7FFF) = 0xFFFF_8000, ext=0x0000
+ mov #0x7FFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0007, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MAC ; 0xC000_0000 + (0x8000 * 0xFFFF) = 0x3FFF_8000, ext=0x0001
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0008, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MAC ; 0xC000_0000 + (0x8000 * 0x8000) = 0x0000_0000, ext=0x0001
+ mov #0x8000, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0009, R15
+ nop
+ nop
+ nop
+ nop
+
+
+ /* -------------- SIGNED MULTIPLY-ACCUMULATE --------------- */
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x3104, &MACS ; 0xC000_0000 + (0x3104 * 0x8285) = 0xA7F9_7F14, ext=0xFFFF
+ mov #0x8285, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0001, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x0000, &MACS ; 0xC000_0000 + (0x0000 * 0x0000) = 0xC000_0000, ext=0xFFFF
+ mov #0x0000, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0002, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x0001, &MACS ; 0xC000_0000 + (0x0001 * 0x0001) = 0xC000_0001, ext=0xFFFF
+ mov #0x0001, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0003, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x7FFF, &MACS ; 0xC000_0000 + (0x7FFF * 0x7FFF) = 0xFFFF_0001, ext=0xFFFF
+ mov #0x7FFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0004, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0xFFFF, &MACS ; 0xC000_0000 + (0xFFFF * 0xFFFF) = 0xC000_0001, ext=0xFFFF
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0005, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x7FFF, &MACS ; 0xC000_0000 + (0x7FFF * 0xFFFF = 0xBFFF_8001, ext=0xFFFF
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0006, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MACS ; 0xC000_0000 + (0x8000 * 0x7FFF) = 0x8000_8000, ext=0xFFFF
+ mov #0x7FFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0007, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MACS ; 0xC000_0000 + (0x8000 * 0xFFFF) = 0xC000_8000, ext=0xFFFF
+ mov #0xFFFF, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0008, R15
+ nop
+ nop
+ nop
+ nop
+
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ mov #0x8000, &MACS ; 0xC000_0000 + (0x8000 * 0x8000) = 0x0000_0000, ext=0x0000
+ mov #0x8000, &OP2
+
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+ nop
+ mov #0x0009, R15
+ nop
+ nop
+ nop
+ nop
+
+
+
+ /* ---------------------- END OF TEST --------------- */
+end_of_test:
+ nop
+ br #0xffff
+
+
+
+
+ /* ---------------------- INTERRUPT VECTORS --------------- */
+
+.section .vectors, "a"
+.word end_of_test ; Interrupt 0 (lowest priority)
+.word end_of_test ; Interrupt 1
+.word end_of_test ; Interrupt 2
+.word end_of_test ; Interrupt 3
+.word end_of_test ; Interrupt 4
+.word end_of_test ; Interrupt 5
+.word end_of_test ; Interrupt 6
+.word end_of_test ; Interrupt 7
+.word end_of_test ; Interrupt 8
+.word end_of_test ; Interrupt 9
+.word end_of_test ; Interrupt 10 Watchdog timer
+.word end_of_test ; Interrupt 11
+.word end_of_test ; Interrupt 12
+.word end_of_test ; Interrupt 13
+.word end_of_test ; Interrupt 14 NMI
+.word main ; Interrupt 15 (highest priority) RESET
rtl_sim/src/mpy_basic.s43
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/mpy_mac.s43
===================================================================
--- rtl_sim/src/mpy_mac.s43 (nonexistent)
+++ rtl_sim/src/mpy_mac.s43 (revision 67)
@@ -0,0 +1,146 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MAC mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+.global main
+
+.set WDTCTL, 0x0120
+
+.set MPY, 0x0130
+.set MPYS, 0x0132
+.set MAC, 0x0134
+.set MACS, 0x0136
+.set OP2, 0x0138
+.set RESLO, 0x013A
+.set RESHI, 0x013C
+.set SUMEXT, 0x013E
+
+
+main:
+
+ /* -------------- UNSIGNED MULTIPLY ACCUMULATE --------------- */
+
+ ;; Disable watchdog
+ mov #0x5A80, &WDTCTL
+
+ ;; Initialize variables
+ mov #0x0000, R15
+ mov #0x0000, R8
+ mov #0x0000, R9
+
+mpy_loop:
+
+ ;; Initialize RESLO and RESHI to make sure it is added
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ ;; Perform unsigned R8*R9
+ mov R8, &MAC
+ mov R9, &OP2
+
+ ;; Read result
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+
+ ;; Notify verilog checker
+ add #1, R15
+
+ ;; Update next OP1 (R8)
+ cmp #0xF0F0, R8
+ jeq op2_update
+
+ mov #0x00FF, R7
+ and R8, R7
+ cmp #0x00F0, R7
+ jeq op1_hi_update
+
+ add #0x0010, R8
+ jmp mpy_loop
+ op1_hi_update:
+ and #0xff00, R8
+ add #0x1000, R8
+ jmp mpy_loop
+
+
+ ;; Update next OP2 (R9)
+ op2_update:
+ cmp #0xF0F0, R9
+ jeq end_of_test
+
+ mov #0x0000, R8
+
+ mov #0x00FF, R7
+ and R9, R7
+ cmp #0x00F0, R7
+ jeq op2_hi_update
+
+ add #0x0010, R9
+ jmp mpy_loop
+ op2_hi_update:
+ and #0xff00, R9
+ add #0x1000, R9
+ jmp mpy_loop
+
+
+
+ /* ---------------------- END OF TEST --------------- */
+end_of_test:
+ nop
+ br #0xffff
+
+
+
+
+ /* ---------------------- INTERRUPT VECTORS --------------- */
+
+.section .vectors, "a"
+.word end_of_test ; Interrupt 0 (lowest priority)
+.word end_of_test ; Interrupt 1
+.word end_of_test ; Interrupt 2
+.word end_of_test ; Interrupt 3
+.word end_of_test ; Interrupt 4
+.word end_of_test ; Interrupt 5
+.word end_of_test ; Interrupt 6
+.word end_of_test ; Interrupt 7
+.word end_of_test ; Interrupt 8
+.word end_of_test ; Interrupt 9
+.word end_of_test ; Interrupt 10 Watchdog timer
+.word end_of_test ; Interrupt 11
+.word end_of_test ; Interrupt 12
+.word end_of_test ; Interrupt 13
+.word end_of_test ; Interrupt 14 NMI
+.word main ; Interrupt 15 (highest priority) RESET
rtl_sim/src/mpy_mac.s43
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/mpy_mpy.s43
===================================================================
--- rtl_sim/src/mpy_mpy.s43 (nonexistent)
+++ rtl_sim/src/mpy_mpy.s43 (revision 67)
@@ -0,0 +1,146 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MPY mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+.global main
+
+.set WDTCTL, 0x0120
+
+.set MPY, 0x0130
+.set MPYS, 0x0132
+.set MAC, 0x0134
+.set MACS, 0x0136
+.set OP2, 0x0138
+.set RESLO, 0x013A
+.set RESHI, 0x013C
+.set SUMEXT, 0x013E
+
+
+main:
+
+ /* -------------- UNSIGNED MULTIPLICATION --------------- */
+
+ ;; Disable watchdog
+ mov #0x5A80, &WDTCTL
+
+ ;; Initialize variables
+ mov #0x0000, R15
+ mov #0x0000, R8
+ mov #0x0000, R9
+
+mpy_loop:
+
+ ;; Initialize RESLO and RESHI to make sure it is overwritten
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ ;; Perform unsigned R8*R9
+ mov R8, &MPY
+ mov R9, &OP2
+
+ ;; Read result
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+
+ ;; Notify verilog checker
+ add #1, R15
+
+ ;; Update next OP1 (R8)
+ cmp #0xF0F0, R8
+ jeq op2_update
+
+ mov #0x00FF, R7
+ and R8, R7
+ cmp #0x00F0, R7
+ jeq op1_hi_update
+
+ add #0x0010, R8
+ jmp mpy_loop
+ op1_hi_update:
+ and #0xff00, R8
+ add #0x1000, R8
+ jmp mpy_loop
+
+
+ ;; Update next OP2 (R9)
+ op2_update:
+ cmp #0xF0F0, R9
+ jeq end_of_test
+
+ mov #0x0000, R8
+
+ mov #0x00FF, R7
+ and R9, R7
+ cmp #0x00F0, R7
+ jeq op2_hi_update
+
+ add #0x0010, R9
+ jmp mpy_loop
+ op2_hi_update:
+ and #0xff00, R9
+ add #0x1000, R9
+ jmp mpy_loop
+
+
+
+ /* ---------------------- END OF TEST --------------- */
+end_of_test:
+ nop
+ br #0xffff
+
+
+
+
+ /* ---------------------- INTERRUPT VECTORS --------------- */
+
+.section .vectors, "a"
+.word end_of_test ; Interrupt 0 (lowest priority)
+.word end_of_test ; Interrupt 1
+.word end_of_test ; Interrupt 2
+.word end_of_test ; Interrupt 3
+.word end_of_test ; Interrupt 4
+.word end_of_test ; Interrupt 5
+.word end_of_test ; Interrupt 6
+.word end_of_test ; Interrupt 7
+.word end_of_test ; Interrupt 8
+.word end_of_test ; Interrupt 9
+.word end_of_test ; Interrupt 10 Watchdog timer
+.word end_of_test ; Interrupt 11
+.word end_of_test ; Interrupt 12
+.word end_of_test ; Interrupt 13
+.word end_of_test ; Interrupt 14 NMI
+.word main ; Interrupt 15 (highest priority) RESET
rtl_sim/src/mpy_mpy.s43
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/mpy_basic.v
===================================================================
--- rtl_sim/src/mpy_basic.v (nonexistent)
+++ rtl_sim/src/mpy_basic.v (revision 67)
@@ -0,0 +1,256 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MPY mode. */
+/* - MPYS mode. */
+/* - MAC mode. */
+/* - MACS mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+
+initial
+ begin
+ $display(" ===============================================");
+ $display("| START SIMULATION |");
+ $display(" ===============================================");
+ repeat(5) @(posedge mclk);
+ stimulus_done = 0;
+
+
+ // UNSIGNED MULTIPLICATION
+ //--------------------------------------------------------
+
+ @(r15===16'h0001);
+ if (r10 !== 16'h7F14) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (1) =====");
+ if (r11 !== 16'h007B) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (1) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (1) =====");
+
+ @(r15===16'h0002);
+ if (r10 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (2) =====");
+ if (r11 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (2) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (2) =====");
+
+ @(r15===16'h0003);
+ if (r10 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (3) =====");
+ if (r11 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (3) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (3) =====");
+
+ @(r15===16'h0004);
+ if (r10 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (4) =====");
+ if (r11 !== 16'h3FFF) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (4) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (4) =====");
+
+ @(r15===16'h0005);
+ if (r10 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (5) =====");
+ if (r11 !== 16'hFFFE) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (5) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (5) =====");
+
+ @(r15===16'h0006);
+ if (r10 !== 16'h8001) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (6) =====");
+ if (r11 !== 16'h7FFE) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (6) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (6) =====");
+
+ @(r15===16'h0007);
+ if (r10 !== 16'h8000) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (7) =====");
+ if (r11 !== 16'h3FFF) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (7) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (7) =====");
+
+ @(r15===16'h0008);
+ if (r10 !== 16'h8000) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (8) =====");
+ if (r11 !== 16'h7FFF) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (8) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (8) =====");
+
+ @(r15===16'h0009);
+ if (r10 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: RESLO (9) =====");
+ if (r11 !== 16'h4000) tb_error("====== UNSIGNED MULTIPLICATION: RESHI (9) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT (9) =====");
+
+ $display("Unsigned Multiplication test completed (MPY mode).");
+
+ // SIGNED MULTIPLICATION
+ //--------------------------------------------------------
+
+ @(r15===16'h0001);
+ if (r10 !== 16'h7F14) tb_error("====== SIGNED MULTIPLICATION: RESLO (1) =====");
+ if (r11 !== 16'hE7F9) tb_error("====== SIGNED MULTIPLICATION: RESHI (1) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (1) =====");
+
+ @(r15===16'h0002);
+ if (r10 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: RESLO (2) =====");
+ if (r11 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: RESHI (2) =====");
+ if (r12 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (2) =====");
+
+ @(r15===16'h0003);
+ if (r10 !== 16'h0001) tb_error("====== SIGNED MULTIPLICATION: RESLO (3) =====");
+ if (r11 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: RESHI (3) =====");
+ if (r12 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (3) =====");
+
+ @(r15===16'h0004);
+ if (r10 !== 16'h0001) tb_error("====== SIGNED MULTIPLICATION: RESLO (4) =====");
+ if (r11 !== 16'h3FFF) tb_error("====== SIGNED MULTIPLICATION: RESHI (4) =====");
+ if (r12 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (4) =====");
+
+ @(r15===16'h0005);
+ if (r10 !== 16'h0001) tb_error("====== SIGNED MULTIPLICATION: RESLO (5) =====");
+ if (r11 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: RESHI (5) =====");
+ if (r12 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (5) =====");
+
+ @(r15===16'h0006);
+ if (r10 !== 16'h8001) tb_error("====== SIGNED MULTIPLICATION: RESLO (6) =====");
+ if (r11 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLICATION: RESHI (6) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (6) =====");
+
+ @(r15===16'h0007);
+ if (r10 !== 16'h8000) tb_error("====== SIGNED MULTIPLICATION: RESLO (7) =====");
+ if (r11 !== 16'hC000) tb_error("====== SIGNED MULTIPLICATION: RESHI (7) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (7) =====");
+
+ @(r15===16'h0008);
+ if (r10 !== 16'h8000) tb_error("====== SIGNED MULTIPLICATION: RESLO (8) =====");
+ if (r11 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: RESHI (8) =====");
+ if (r12 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (8) =====");
+
+ @(r15===16'h0009);
+ if (r10 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: RESLO (9) =====");
+ if (r11 !== 16'h4000) tb_error("====== SIGNED MULTIPLICATION: RESHI (9) =====");
+ if (r12 !== 16'h0000) tb_error("====== SIGNED MULTIPLICATION: SUMEXT (9) =====");
+
+ $display("Signed Multiplication test completed (MPYS mode)");
+
+
+ // UNSIGNED MULTIPLY ACCUMULATE
+ //--------------------------------------------------------
+
+ @(r15===16'h0001);
+ if (r10 !== 16'h7F14) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (1) =====");
+ if (r11 !== 16'hC07B) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (1) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (1) =====");
+
+ @(r15===16'h0002);
+ if (r10 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (2) =====");
+ if (r11 !== 16'hC000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (2) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (2) =====");
+
+ @(r15===16'h0003);
+ if (r10 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (3) =====");
+ if (r11 !== 16'hC000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (3) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (3) =====");
+
+ @(r15===16'h0004);
+ if (r10 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (4) =====");
+ if (r11 !== 16'hFFFF) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (4) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (4) =====");
+
+ @(r15===16'h0005);
+ if (r10 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (5) =====");
+ if (r11 !== 16'hBFFE) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (5) =====");
+ if (r12 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (5) =====");
+
+ @(r15===16'h0006);
+ if (r10 !== 16'h8001) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (6) =====");
+ if (r11 !== 16'h3FFE) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (6) =====");
+ if (r12 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (6) =====");
+
+ @(r15===16'h0007);
+ if (r10 !== 16'h8000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (7) =====");
+ if (r11 !== 16'hFFFF) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (7) =====");
+ if (r12 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (7) =====");
+
+ @(r15===16'h0008);
+ if (r10 !== 16'h8000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (8) =====");
+ if (r11 !== 16'h3FFF) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (8) =====");
+ if (r12 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (8) =====");
+
+ @(r15===16'h0009);
+ if (r10 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESLO (9) =====");
+ if (r11 !== 16'h0000) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: RESHI (9) =====");
+ if (r12 !== 16'h0001) tb_error("====== UNSIGNED MULTIPLY ACCUMULATE: SUMEXT (9) =====");
+
+ $display("Unsigned Multiply Accumulate test completed (MAC mode)");
+
+
+ // SIGNED MULTIPLY ACCUMULATE
+ //--------------------------------------------------------
+
+ @(r15===16'h0001);
+ if (r10 !== 16'h7F14) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (1) =====");
+ if (r11 !== 16'hA7F9) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (1) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (1) =====");
+
+ @(r15===16'h0002);
+ if (r10 !== 16'h0000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (2) =====");
+ if (r11 !== 16'hC000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (2) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (2) =====");
+
+ @(r15===16'h0003);
+ if (r10 !== 16'h0001) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (3) =====");
+ if (r11 !== 16'hC000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (3) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (3) =====");
+
+ @(r15===16'h0004);
+ if (r10 !== 16'h0001) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (4) =====");
+ if (r11 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (4) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (4) =====");
+
+ @(r15===16'h0005);
+ if (r10 !== 16'h0001) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (5) =====");
+ if (r11 !== 16'hC000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (5) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (5) =====");
+
+ @(r15===16'h0006);
+ if (r10 !== 16'h8001) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (6) =====");
+ if (r11 !== 16'hBFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (6) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (6) =====");
+
+ @(r15===16'h0007);
+ if (r10 !== 16'h8000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (7) =====");
+ if (r11 !== 16'h8000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (7) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (7) =====");
+
+ @(r15===16'h0008);
+ if (r10 !== 16'h8000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (8) =====");
+ if (r11 !== 16'hC000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (8) =====");
+ if (r12 !== 16'hFFFF) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (8) =====");
+
+ @(r15===16'h0009);
+ if (r10 !== 16'h0000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO (9) =====");
+ if (r11 !== 16'h0000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI (9) =====");
+ if (r12 !== 16'h0000) tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT (9) =====");
+
+ $display("Signed Multiply Accumulate test completed (MACS mode)");
+
+
+ stimulus_done = 1;
+ end
+
rtl_sim/src/mpy_basic.v
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/mpy_mpy.v
===================================================================
--- rtl_sim/src/mpy_mpy.v (nonexistent)
+++ rtl_sim/src/mpy_mpy.v (revision 67)
@@ -0,0 +1,87 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MPY mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+`define NO_TIMEOUT
+
+integer i;
+reg [31:0] result;
+
+initial
+ begin
+ $display(" ===============================================");
+ $display("| START SIMULATION |");
+ $display(" ===============================================");
+ repeat(5) @(posedge mclk);
+ stimulus_done = 0;
+ i = 0;
+
+
+ for ( i=0; i < 'h10000; i=i+1)
+ begin
+ @(r15);
+ result = r8*r9;
+ if (r10 !== result[15:0])
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", 0, result[31:16], result[15:0]);
+ tb_error("====== UNSIGNED MULTIPLICATION: RESLO =====");
+ end
+ if (r11 !== result[31:16])
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", 0, result[31:16], result[15:0]);
+ tb_error("====== UNSIGNED MULTIPLICATION: RESHI =====");
+ end
+ if (r12 !== 16'h0000)
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", 0, result[31:16], result[15:0]);
+ tb_error("====== UNSIGNED MULTIPLICATION: SUMEXT =====");
+ end
+
+ if (r15[7:0]==8'h00)
+ $display("OP2 = 0x%h done", r9);
+ end
+
+
+
+ stimulus_done = 1;
+ end
+
rtl_sim/src/mpy_mpy.v
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/mpy_macs.s43
===================================================================
--- rtl_sim/src/mpy_macs.s43 (nonexistent)
+++ rtl_sim/src/mpy_macs.s43 (revision 67)
@@ -0,0 +1,146 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MACS mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+.global main
+
+.set WDTCTL, 0x0120
+
+.set MPY, 0x0130
+.set MPYS, 0x0132
+.set MAC, 0x0134
+.set MACS, 0x0136
+.set OP2, 0x0138
+.set RESLO, 0x013A
+.set RESHI, 0x013C
+.set SUMEXT, 0x013E
+
+
+main:
+
+ /* -------------- SIGNED MULTIPLY ACCUMULATE --------------- */
+
+ ;; Disable watchdog
+ mov #0x5A80, &WDTCTL
+
+ ;; Initialize variables
+ mov #0x0000, R15
+ mov #0x0000, R8
+ mov #0x0000, R9
+
+mpy_loop:
+
+ ;; Initialize RESLO and RESHI to make sure it is added
+ mov #0x0000, &RESLO
+ mov #0xC000, &RESHI
+
+ ;; Perform unsigned R8*R9
+ mov R8, &MACS
+ mov R9, &OP2
+
+ ;; Read result
+ mov &RESLO, R10
+ mov &RESHI, R11
+ mov &SUMEXT, R12
+
+ ;; Notify verilog checker
+ add #1, R15
+
+ ;; Update next OP1 (R8)
+ cmp #0xF0F0, R8
+ jeq op2_update
+
+ mov #0x00FF, R7
+ and R8, R7
+ cmp #0x00F0, R7
+ jeq op1_hi_update
+
+ add #0x0010, R8
+ jmp mpy_loop
+ op1_hi_update:
+ and #0xff00, R8
+ add #0x1000, R8
+ jmp mpy_loop
+
+
+ ;; Update next OP2 (R9)
+ op2_update:
+ cmp #0xF0F0, R9
+ jeq end_of_test
+
+ mov #0x0000, R8
+
+ mov #0x00FF, R7
+ and R9, R7
+ cmp #0x00F0, R7
+ jeq op2_hi_update
+
+ add #0x0010, R9
+ jmp mpy_loop
+ op2_hi_update:
+ and #0xff00, R9
+ add #0x1000, R9
+ jmp mpy_loop
+
+
+
+ /* ---------------------- END OF TEST --------------- */
+end_of_test:
+ nop
+ br #0xffff
+
+
+
+
+ /* ---------------------- INTERRUPT VECTORS --------------- */
+
+.section .vectors, "a"
+.word end_of_test ; Interrupt 0 (lowest priority)
+.word end_of_test ; Interrupt 1
+.word end_of_test ; Interrupt 2
+.word end_of_test ; Interrupt 3
+.word end_of_test ; Interrupt 4
+.word end_of_test ; Interrupt 5
+.word end_of_test ; Interrupt 6
+.word end_of_test ; Interrupt 7
+.word end_of_test ; Interrupt 8
+.word end_of_test ; Interrupt 9
+.word end_of_test ; Interrupt 10 Watchdog timer
+.word end_of_test ; Interrupt 11
+.word end_of_test ; Interrupt 12
+.word end_of_test ; Interrupt 13
+.word end_of_test ; Interrupt 14 NMI
+.word main ; Interrupt 15 (highest priority) RESET
rtl_sim/src/mpy_macs.s43
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/mpy_mpys.v
===================================================================
--- rtl_sim/src/mpy_mpys.v (nonexistent)
+++ rtl_sim/src/mpy_mpys.v (revision 67)
@@ -0,0 +1,89 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MPYS mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+`define NO_TIMEOUT
+
+integer i;
+reg signed [31:0] result;
+wire signed [15:0] r8_s = r8;
+wire signed [15:0] r9_s = r9;
+
+initial
+ begin
+ $display(" ===============================================");
+ $display("| START SIMULATION |");
+ $display(" ===============================================");
+ repeat(5) @(posedge mclk);
+ stimulus_done = 0;
+ i = 0;
+
+
+ for ( i=0; i < 'h10000; i=i+1)
+ begin
+ @(r15);
+ result = r8_s*r9_s;
+ if (r10 !== result[15:0])
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {16{result[31]}}, result[31:16], result[15:0]);
+ tb_error("====== SIGNED MULTIPLICATION: RESLO =====");
+ end
+ if (r11 !== result[31:16])
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {16{result[31]}}, result[31:16], result[15:0]);
+ tb_error("====== SIGNED MULTIPLICATION: RESHI =====");
+ end
+ if (r12 !== {16{result[31]}})
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {16{result[31]}}, result[31:16], result[15:0]);
+ tb_error("====== SIGNED MULTIPLICATION: SUMEXT =====");
+ end
+
+ if (r15[7:0]==8'h00)
+ $display("OP2 = 0x%h done", r9);
+ end
+
+
+
+ stimulus_done = 1;
+ end
+
rtl_sim/src/mpy_mpys.v
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: rtl_sim/src/submit.f
===================================================================
--- rtl_sim/src/submit.f (revision 65)
+++ rtl_sim/src/submit.f (revision 67)
@@ -50,6 +50,7 @@
../../../rtl/verilog/omsp_dbg_hwbrk.v
../../../rtl/verilog/omsp_dbg_uart.v
../../../rtl/verilog/omsp_watchdog.v
+../../../rtl/verilog/omsp_multiplier.v
../../../rtl/verilog/periph/omsp_gpio.v
../../../rtl/verilog/periph/omsp_timerA.v
../../../rtl/verilog/periph/template_periph_8b.v
Index: rtl_sim/src/mpy_macs.v
===================================================================
--- rtl_sim/src/mpy_macs.v (nonexistent)
+++ rtl_sim/src/mpy_macs.v (revision 67)
@@ -0,0 +1,90 @@
+/*===========================================================================*/
+/* Copyright (C) 2001 Authors */
+/* */
+/* This source file may be used and distributed without restriction provided */
+/* that this copyright statement is not removed from the file and that any */
+/* derivative work contains the original copyright notice and the associated */
+/* disclaimer. */
+/* */
+/* This source file is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU Lesser General Public License as published */
+/* by the Free Software Foundation; either version 2.1 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This source is distributed in the hope that it will be useful, but WITHOUT*/
+/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
+/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
+/* License for more details. */
+/* */
+/* You should have received a copy of the GNU Lesser General Public License */
+/* along with this source; if not, write to the Free Software Foundation, */
+/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
+/* */
+/*===========================================================================*/
+/* HARDWARE MULTIPLIER */
+/*---------------------------------------------------------------------------*/
+/* Test the hardware multiplier: */
+/* - MACS mode. */
+/* */
+/* Author(s): */
+/* - Olivier Girard, olgirard@gmail.com */
+/* */
+/*---------------------------------------------------------------------------*/
+/* $Rev: 18 $ */
+/* $LastChangedBy: olivier.girard $ */
+/* $LastChangedDate: 2009-08-04 23:44:12 +0200 (Tue, 04 Aug 2009) $ */
+/*===========================================================================*/
+
+`define NO_TIMEOUT
+
+integer i;
+reg signed [31:0] result;
+wire signed [15:0] r8_s = r8;
+wire signed [15:0] r9_s = r9;
+
+initial
+ begin
+ $display(" ===============================================");
+ $display("| START SIMULATION |");
+ $display(" ===============================================");
+ repeat(5) @(posedge mclk);
+ stimulus_done = 0;
+ i = 0;
+
+
+ for ( i=0; i < 'h10000; i=i+1)
+ begin
+ @(r15);
+ result = r8_s*r9_s;
+ result = 32'hC000_0000 + result;
+ if (r10 !== result[15:0])
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {16{result[31]}}, result[31:16], result[15:0]);
+ tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESLO =====");
+ end
+ if (r11 !== result[31:16])
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {16{result[31]}}, result[31:16], result[15:0]);
+ tb_error("====== SIGNED MULTIPLY ACCUMULATE: RESHI =====");
+ end
+ if (r12 !== {16{result[31]}})
+ begin
+ $display("ERROR: OP1 = 0x%h / OP2 = 0x%h", r8, r9);
+ $display("ERROR: Result is: SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", r12, r11, r10);
+ $display("ERROR: Expected : SUMEXT = 0x%h / RESHI = 0x%h / RESLO = 0x%h", {16{result[31]}}, result[31:16], result[15:0]);
+ tb_error("====== SIGNED MULTIPLY ACCUMULATE: SUMEXT =====");
+ end
+
+ if (r15[7:0]==8'h00)
+ $display("OP2 = 0x%h done", r9);
+ end
+
+
+
+ stimulus_done = 1;
+ end
+
rtl_sim/src/mpy_macs.v
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property