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 |
|
|
/* CONDITIONAL JUMP: JN INSTRUCTION */
|
25 |
|
|
/*---------------------------------------------------------------------------*/
|
26 |
|
|
/* Test the JN instruction. */
|
27 |
18 |
olivier.gi |
/* */
|
28 |
|
|
/* Author(s): */
|
29 |
|
|
/* - Olivier Girard, olgirard@gmail.com */
|
30 |
|
|
/* */
|
31 |
|
|
/*---------------------------------------------------------------------------*/
|
32 |
19 |
olivier.gi |
/* $Rev: 19 $ */
|
33 |
|
|
/* $LastChangedBy: olivier.girard $ */
|
34 |
|
|
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $ */
|
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 |
|
|
|
45 |
|
|
|
46 |
|
|
// TEST JUMP FORWARD AND BACKWARD
|
47 |
|
|
@(r15==16'h1000);
|
48 |
|
|
if (r4 !==16'h1234) tb_error("====== JN (jump forward 1) =====");
|
49 |
|
|
if (r5 !==16'h5678) tb_error("====== JN (jump backward) =====");
|
50 |
|
|
if (r6 !==16'h9abc) tb_error("====== JN (jump forward 2) =====");
|
51 |
|
|
|
52 |
|
|
// TEST JUMP FOR ALL FLAG CONFIGURATIONS
|
53 |
|
|
@(r15==16'h2000);
|
54 |
|
|
if (r4 !==16'h0000) tb_error("====== JN ({V,N,Z,C}=4'b0000) ==");
|
55 |
|
|
@(r15==16'h2001);
|
56 |
|
|
if (r4 !==16'h0000) tb_error("====== JN ({V,N,Z,C}=4'b0001) ==");
|
57 |
|
|
@(r15==16'h2002);
|
58 |
|
|
if (r4 !==16'h0000) tb_error("====== JN ({V,N,Z,C}=4'b0010) ==");
|
59 |
|
|
@(r15==16'h2003);
|
60 |
|
|
if (r4 !==16'h0000) tb_error("====== JN ({V,N,Z,C}=4'b0011) ==");
|
61 |
|
|
@(r15==16'h2004);
|
62 |
|
|
if (r4 !==16'h1234) tb_error("====== JN ({V,N,Z,C}=4'b0100) ==");
|
63 |
|
|
@(r15==16'h2005);
|
64 |
|
|
if (r4 !==16'h1234) tb_error("====== JN ({V,N,Z,C}=4'b0101) ==");
|
65 |
|
|
@(r15==16'h2006);
|
66 |
|
|
if (r4 !==16'h1234) tb_error("====== JN ({V,N,Z,C}=4'b0110) ==");
|
67 |
|
|
@(r15==16'h2007);
|
68 |
|
|
if (r4 !==16'h1234) tb_error("====== JN ({V,N,Z,C}=4'b0111) ==");
|
69 |
|
|
@(r15==16'h2008);
|
70 |
|
|
if (r4 !==16'h0000) tb_error("====== JN ({V,N,Z,C}=4'b1000) ==");
|
71 |
|
|
@(r15==16'h2009);
|
72 |
|
|
if (r4 !==16'h0000) tb_error("====== JN ({V,N,Z,C}=4'b1001) ==");
|
73 |
|
|
@(r15==16'h200A);
|
74 |
|
|
if (r4 !==16'h0000) tb_error("====== JN ({V,N,Z,C}=4'b1010) ==");
|
75 |
|
|
@(r15==16'h200B);
|
76 |
|
|
if (r4 !==16'h0000) tb_error("====== JN ({V,N,Z,C}=4'b1011) ==");
|
77 |
|
|
@(r15==16'h200C);
|
78 |
|
|
if (r4 !==16'h1234) tb_error("====== JN ({V,N,Z,C}=4'b1100) ==");
|
79 |
|
|
@(r15==16'h200D);
|
80 |
|
|
if (r4 !==16'h1234) tb_error("====== JN ({V,N,Z,C}=4'b1101) ==");
|
81 |
|
|
@(r15==16'h200E);
|
82 |
|
|
if (r4 !==16'h1234) tb_error("====== JN ({V,N,Z,C}=4'b1110) ==");
|
83 |
|
|
@(r15==16'h200F);
|
84 |
|
|
if (r4 !==16'h1234) tb_error("====== JN ({V,N,Z,C}=4'b1111) ==");
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
stimulus_done = 1;
|
88 |
|
|
end
|
89 |
|
|
|