OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [sing-op_call.v] - Blame information for rev 219

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 olivier.gi
/*===========================================================================*/
2
/* Copyright (C) 2001 Authors                                                */
3
/*                                                                           */
4
/* This source file may be used and distributed without restriction provided */
5
/* that this copyright statement is not removed from the file and that any   */
6
/* derivative work contains the original copyright notice and the associated */
7
/* disclaimer.                                                               */
8
/*                                                                           */
9
/* This source file is free software; you can redistribute it and/or modify  */
10
/* it under the terms of the GNU Lesser General Public License as published  */
11
/* by the Free Software Foundation; either version 2.1 of the License, or    */
12
/* (at your option) any later version.                                       */
13
/*                                                                           */
14
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
15
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     */
16
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public       */
17
/* License for more details.                                                 */
18
/*                                                                           */
19
/* You should have received a copy of the GNU Lesser General Public License  */
20
/* along with this source; if not, write to the Free Software Foundation,    */
21
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA        */
22
/*                                                                           */
23
/*===========================================================================*/
24
/*                 SINGLE-OPERAND ARITHMETIC: CALL  INSTRUCTION              */
25
/*---------------------------------------------------------------------------*/
26
/* Test the CALL instruction.                                                */
27 18 olivier.gi
/*                                                                           */
28
/* Author(s):                                                                */
29
/*             - Olivier Girard,    olgirard@gmail.com                       */
30
/*                                                                           */
31
/*---------------------------------------------------------------------------*/
32 19 olivier.gi
/* $Rev: 128 $                                                                */
33
/* $LastChangedBy: olivier.girard $                                          */
34
/* $LastChangedDate: 2011-12-16 22:05:46 +0100 (Fri, 16 Dec 2011) $          */
35 2 olivier.gi
/*===========================================================================*/
36
 
37
initial
38
   begin
39
      $display(" ===============================================");
40
      $display("|                 START SIMULATION              |");
41
      $display(" ===============================================");
42
      repeat(5) @(posedge mclk);
43
      stimulus_done = 0;
44 128 olivier.gi
 
45
      /* -------------- TEST INSTRUCTION WITH STANDARD REGISTERS AS ARGUMENT ------------------- */
46 2 olivier.gi
 
47
      // Initialization
48
      @(r15==16'h1000);
49 111 olivier.gi
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== SP  initialization =====");
50
      if (r5    !==16'h0000)             tb_error("====== R5  initialization  =====");
51 2 olivier.gi
 
52
 
53
      // Addressing mode: Rn
54
      @(r15==16'h2000);
55 111 olivier.gi
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== CALL (Rn mode): SP value      =====");
56
      if (r5    !==16'h1234)             tb_error("====== CALL (Rn mode): R5 value      =====");
57 2 olivier.gi
 
58
 
59
      // Addressing mode: @Rn
60
      @(r15==16'h3000);
61 111 olivier.gi
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== CALL (@Rn mode): SP value      =====");
62
      if (r4    !==(`PER_SIZE+16'h0012)) tb_error("====== CALL (@Rn mode): R4 value      =====");
63
      if (r5    !==16'h5678)             tb_error("====== CALL (@Rn mode): R5 value      =====");
64 2 olivier.gi
 
65
 
66
      // Addressing mode: @Rn+
67
      @(r15==16'h4000);
68 111 olivier.gi
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== CALL (@Rn+ mode): SP value      =====");
69
      if (r4    !==(`PER_SIZE+16'h0018)) tb_error("====== CALL (@Rn+ mode): R4 value      =====");
70
      if (r5    !==16'h9abc)             tb_error("====== CALL (@Rn+ mode): R5 value      =====");
71 2 olivier.gi
 
72
      // Addressing mode: #N
73
      @(r15==16'h5000);
74 111 olivier.gi
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== CALL (#N mode): SP value      =====");
75
      if (r5    !==16'habcd)             tb_error("====== CALL (#N mode): R5 value      =====");
76 2 olivier.gi
 
77
 
78
      // Addressing mode: X(Rn)
79
      @(r15==16'h6000);
80 111 olivier.gi
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== CALL (X(Rn) mode): SP value      =====");
81
      if (r5    !==16'hef01)             tb_error("====== CALL (X(Rn) mode): R5 value      =====");
82 2 olivier.gi
 
83
 
84
      // Addressing mode: EDE
85
      @(r15==16'h7000);
86 111 olivier.gi
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== CALL (EDE mode): SP value      =====");
87
      if (r5    !==16'h2345)             tb_error("====== CALL (EDE mode): R5 value      =====");
88 2 olivier.gi
 
89
 
90
      // Addressing mode: &EDE
91
      @(r15==16'h8000);
92 111 olivier.gi
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== CALL (&EDE mode): SP value      =====");
93
      if (r5    !==16'h6789)             tb_error("====== CALL (&EDE mode): R5 value      =====");
94 2 olivier.gi
 
95
 
96 128 olivier.gi
      /* -------------- TEST INSTRUCTION WITH SR AS ARGUMENT ------------------- */
97
 
98
 
99
      // Addressing mode: SR
100
      @(r15==16'h9000);
101
      //  --> not tested because it would require the cpu to execute from the data memory
102
 
103
 
104
      // Addressing mode: @SR
105
      @(r15==16'hA000);
106
      if (r5    !==16'habcd)             tb_error("====== CALL @SR  : R5 value      =====");
107
 
108
 
109
      // Addressing mode: @SR+
110
      @(r15==16'hB000);
111
      if (r5    !==16'h159a)             tb_error("====== CALL @SR+ : R5 value      =====");
112
 
113
 
114
      // Addressing mode: x(SR)
115
      @(r15==16'hC000);
116
      if (r5    !==16'h9abc)             tb_error("====== CALL x(SR) : R5 value      =====");
117
      if (r6    !==16'hef01)             tb_error("====== CALL x(SR) : R6 value      =====");
118
      if (r7    !==16'h2345)             tb_error("====== CALL x(SR) : R7 value      =====");
119
 
120 2 olivier.gi
      stimulus_done = 1;
121
   end
122
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.