OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [cpu/] [alu/] [test_prep_daa.sv] - Blame information for rev 4

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

Line No. Rev Author Line
1 3 gdevic
//==============================================================
2
// Test ALU state preparation for DAA instruction
3
//==============================================================
4
`timescale 100 ns/ 100 ns
5
 
6
module test_prep_daa;
7
 
8
// ----------------- INPUT -----------------
9
reg [3:0] low_sig;          // Input data bus A (independent)
10
reg [3:0] high_sig;         // Input data bus B (independent)
11
 
12
// ----------------- OUTPUT -----------------
13
wire low_gt_9_sig;          // low bus > 9
14
wire high_gt_9_sig;         // high bus > 9
15
wire high_eq_9_sig;         // high bus == 9
16
 
17
// ----------------- TEST -------------------
18
`define CHECK \
19
   assert(low_gt_9_sig==low_sig>9 && high_gt_9_sig==high_sig>9 && high_eq_9_sig==(high_sig==9));
20
 
21
initial begin
22
    low_sig  = 4'h0;
23
    high_sig = 4'h0;
24
    #1 `CHECK
25
    low_sig  = 4'h1;
26
    high_sig = 4'h1;
27
    #1 `CHECK
28
    low_sig  = 4'h2;
29
    high_sig = 4'h2;
30
    #1 `CHECK
31
    low_sig  = 4'h3;
32
    high_sig = 4'h3;
33
    #1 `CHECK
34
    low_sig  = 4'h4;
35
    high_sig = 4'h4;
36
    #1 `CHECK
37
    low_sig  = 4'h5;
38
    high_sig = 4'h5;
39
    #1 `CHECK
40
    low_sig  = 4'h6;
41
    high_sig = 4'h6;
42
    #1 `CHECK
43
    low_sig  = 4'h7;
44
    high_sig = 4'h7;
45
    #1 `CHECK
46
    low_sig  = 4'h8;
47
    high_sig = 4'h8;
48
    #1 `CHECK
49
    low_sig  = 4'h9;
50
    high_sig = 4'h9;
51
    #1 `CHECK
52
    low_sig  = 4'hA;
53
    high_sig = 4'hA;
54
    #1 `CHECK
55
    low_sig  = 4'hB;
56
    high_sig = 4'hB;
57
    #1 `CHECK
58
    low_sig  = 4'hC;
59
    high_sig = 4'hC;
60
    #1 `CHECK
61
    low_sig  = 4'hD;
62
    high_sig = 4'hD;
63
    #1 `CHECK
64
    low_sig  = 4'hE;
65
    high_sig = 4'hE;
66
    #1 `CHECK
67
    low_sig  = 4'hF;
68
    high_sig = 4'hF;
69
    #1 `CHECK
70
 
71
    #1 $display("End of test");
72
end
73
 
74
//--------------------------------------------------------------
75
// Instantiate prep-DAA block
76
//--------------------------------------------------------------
77
alu_prep_daa alu_prep_daa_inst
78
(
79
    .low(low_sig) ,             // input [3:0] low_sig
80
    .high(high_sig) ,           // input [3:0] high_sig
81
    .low_gt_9(low_gt_9_sig) ,   // output  low_gt_9_sig
82
    .high_eq_9(high_eq_9_sig) , // output  high_eq_9_sig
83
    .high_gt_9(high_gt_9_sig)   // output  high_gt_9_sig
84
);
85
 
86
endmodule

powered by: WebSVN 2.1.0

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