-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsp_m_tb.v
104 lines (100 loc) · 1.55 KB
/
sp_m_tb.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: UET Lahore
// Engineer: Umer Shahid, Shehzeen Malik, Ahsan Ali
//
// Create Date: 27.01.2022 18:57:50
// Design Name:
// Module Name: sp_m_tb
// Project Name: SPI Implementation
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module sp_m_tb();
reg [7:0] m_data_send;
reg clk;
reg ss;
wire mosi;
wire sp_clk;
reg miso;
wire busy_m;
wire [7:0] m_rece;
//wire [7:0] received_data;
// wire [3:0] i;
// wire [7:0] miso_buf;
// wire [7:0] mosi_buf;
// wire [7:0] m_data;
sp1_m uut(m_data_send,clk,miso,ss, mosi,sp_clk,busy_m, m_rece);//received_data,
// define clock
initial begin
clk = 0;
forever #5 clk = ~clk;
end
initial begin
// Initialize Inputs
m_data_send=0;
miso=0;
ss = 1;
#45;
ss = 0;
m_data_send = 8'hab;
miso=1;
#45;
miso=0;
#45;
miso=1;
#45;
miso=0;
#45;
miso=1;
#45;
miso=0;
#45;
m_data_send = 8'h61;
miso=1;
#45;
miso =1;
#45;
ss=1;
miso = 0;
#45;
miso =0;
#45;
miso=1;
ss=0;
#45;
miso=1;
#45;
miso=0;
#45;
miso=0;
m_data_send = 8'h45;
miso=1;
#45;
miso=0;
#45;
miso=0;
#45;
miso=0;
#45;
miso=1;
#45;
miso=1;
#45;
miso=1;
#45;
miso=0;
#45;
miso=0;
#80;
$finish;
end
endmodule