1 |
4 |
hippo5329 |
# +-----------------------------------
|
2 |
|
|
# |
|
3 |
|
|
# | tiny_spi "tiny_spi" v1.0
|
4 |
|
|
# | Thomas Chou 2010.01.19.18:07:51
|
5 |
|
|
# | SPI 8 bits
|
6 |
|
|
# |
|
7 |
|
|
# | tiny_spi/hdl/tiny_spi.v
|
8 |
|
|
# |
|
9 |
|
|
# | ./hdl/tiny_spi.v syn, sim
|
10 |
|
|
# |
|
11 |
|
|
# +-----------------------------------
|
12 |
|
|
|
13 |
|
|
# +-----------------------------------
|
14 |
|
|
# | module tiny_spi
|
15 |
|
|
# |
|
16 |
|
|
set_module_property DESCRIPTION "tiny SPI 8 bits"
|
17 |
|
|
set_module_property NAME tiny_spi
|
18 |
|
|
set_module_property VERSION 1.0
|
19 |
|
|
set_module_property INTERNAL false
|
20 |
|
|
set_module_property GROUP "Interface Protocols/Serial"
|
21 |
|
|
set_module_property AUTHOR "Thomas Chou"
|
22 |
|
|
set_module_property DISPLAY_NAME "OpenCores tiny SPI"
|
23 |
|
|
set_module_property TOP_LEVEL_HDL_FILE hdl/tiny_spi.v
|
24 |
|
|
set_module_property TOP_LEVEL_HDL_MODULE tiny_spi
|
25 |
|
|
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
26 |
|
|
set_module_property EDITABLE true
|
27 |
|
|
set_module_property ANALYZE_HDL TRUE
|
28 |
|
|
# |
|
29 |
|
|
# +-----------------------------------
|
30 |
|
|
|
31 |
|
|
# +-----------------------------------
|
32 |
|
|
# | files
|
33 |
|
|
# |
|
34 |
|
|
add_file hdl/tiny_spi.v {SYNTHESIS SIMULATION}
|
35 |
|
|
# |
|
36 |
|
|
# +-----------------------------------
|
37 |
|
|
|
38 |
|
|
# +-----------------------------------
|
39 |
|
|
# | parameters
|
40 |
|
|
# |
|
41 |
|
|
# |
|
42 |
|
|
# +-----------------------------------
|
43 |
|
|
add_parameter BAUD_WIDTH INTEGER 8
|
44 |
|
|
set_parameter_property BAUD_WIDTH DEFAULT_VALUE 8
|
45 |
|
|
set_parameter_property BAUD_WIDTH DISPLAY_NAME BAUD_WIDTH
|
46 |
|
|
set_parameter_property BAUD_WIDTH TYPE INTEGER
|
47 |
|
|
set_parameter_property BAUD_WIDTH UNITS None
|
48 |
|
|
set_parameter_property BAUD_WIDTH AFFECTS_GENERATION false
|
49 |
|
|
set_parameter_property BAUD_WIDTH HDL_PARAMETER true
|
50 |
|
|
add_parameter BAUD_DIV INTEGER 0
|
51 |
|
|
set_parameter_property BAUD_DIV DEFAULT_VALUE 0
|
52 |
|
|
set_parameter_property BAUD_DIV DISPLAY_NAME BAUD_DIV
|
53 |
|
|
set_parameter_property BAUD_DIV TYPE INTEGER
|
54 |
|
|
set_parameter_property BAUD_DIV UNITS None
|
55 |
|
|
set_parameter_property BAUD_DIV AFFECTS_GENERATION false
|
56 |
|
|
set_parameter_property BAUD_DIV HDL_PARAMETER true
|
57 |
|
|
add_parameter SPI_MODE INTEGER 0
|
58 |
|
|
set_parameter_property SPI_MODE DEFAULT_VALUE 0
|
59 |
|
|
set_parameter_property SPI_MODE DISPLAY_NAME SPI_MODE
|
60 |
|
|
set_parameter_property SPI_MODE TYPE INTEGER
|
61 |
|
|
set_parameter_property SPI_MODE UNITS None
|
62 |
|
|
set_parameter_property SPI_MODE AFFECTS_GENERATION false
|
63 |
|
|
set_parameter_property SPI_MODE HDL_PARAMETER true
|
64 |
|
|
|
65 |
|
|
# +-----------------------------------
|
66 |
|
|
# | display items
|
67 |
|
|
# |
|
68 |
|
|
# |
|
69 |
|
|
# +-----------------------------------
|
70 |
|
|
|
71 |
|
|
# +-----------------------------------
|
72 |
|
|
# | connection point d
|
73 |
|
|
# |
|
74 |
|
|
add_interface d avalon end
|
75 |
|
|
set_interface_property d addressAlignment NATIVE
|
76 |
|
|
set_interface_property d addressUnits WORDS
|
77 |
|
|
set_interface_property d associatedClock clk
|
78 |
|
|
set_interface_property d associatedReset reset
|
79 |
|
|
set_interface_property d burstOnBurstBoundariesOnly false
|
80 |
|
|
set_interface_property d explicitAddressSpan 0
|
81 |
|
|
set_interface_property d holdTime 0
|
82 |
|
|
set_interface_property d isMemoryDevice false
|
83 |
|
|
set_interface_property d isNonVolatileStorage false
|
84 |
|
|
set_interface_property d linewrapBursts false
|
85 |
|
|
set_interface_property d maximumPendingReadTransactions 0
|
86 |
|
|
set_interface_property d printableDevice false
|
87 |
|
|
set_interface_property d readLatency 0
|
88 |
|
|
set_interface_property d readWaitStates 0
|
89 |
|
|
set_interface_property d readWaitTime 0
|
90 |
|
|
set_interface_property d setupTime 0
|
91 |
|
|
set_interface_property d timingUnits Cycles
|
92 |
|
|
set_interface_property d writeWaitTime 0
|
93 |
|
|
|
94 |
|
|
set_interface_property d ENABLED true
|
95 |
|
|
|
96 |
|
|
add_interface_port d stb_i chipselect Input 1
|
97 |
|
|
add_interface_port d we_i write Input 1
|
98 |
|
|
add_interface_port d dat_i writedata Input 32
|
99 |
|
|
add_interface_port d adr_i address Input 3
|
100 |
|
|
add_interface_port d dat_o readdata Output 32
|
101 |
|
|
# |
|
102 |
|
|
# +-----------------------------------
|
103 |
|
|
|
104 |
|
|
# +-----------------------------------
|
105 |
|
|
# | connection point clk
|
106 |
|
|
# |
|
107 |
|
|
add_interface clk clock end
|
108 |
|
|
|
109 |
|
|
set_interface_property clk ENABLED true
|
110 |
|
|
|
111 |
|
|
add_interface_port clk clk_i clk Input 1
|
112 |
|
|
# |
|
113 |
|
|
# +-----------------------------------
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
# +-----------------------------------
|
117 |
|
|
# | connection point reset
|
118 |
|
|
# |
|
119 |
|
|
add_interface reset reset end
|
120 |
|
|
set_interface_property reset associatedClock clk
|
121 |
|
|
set_interface_property reset synchronousEdges DEASSERT
|
122 |
|
|
|
123 |
|
|
set_interface_property reset ENABLED true
|
124 |
|
|
|
125 |
|
|
add_interface_port reset rst_i reset Input 1
|
126 |
|
|
# |
|
127 |
|
|
# +-----------------------------------
|
128 |
|
|
|
129 |
|
|
# +-----------------------------------
|
130 |
|
|
# | connection point irq
|
131 |
|
|
# |
|
132 |
|
|
add_interface irq interrupt end
|
133 |
|
|
set_interface_property irq associatedAddressablePoint d
|
134 |
|
|
set_interface_property irq associatedClock clk
|
135 |
|
|
set_interface_property irq associatedReset reset
|
136 |
|
|
set_interface_property irq ENABLED true
|
137 |
|
|
|
138 |
|
|
add_interface_port irq int_o irq Output 1
|
139 |
|
|
# |
|
140 |
|
|
# +-----------------------------------
|
141 |
|
|
|
142 |
|
|
# +-----------------------------------
|
143 |
|
|
# | connection point spi
|
144 |
|
|
# |
|
145 |
|
|
add_interface spi conduit end
|
146 |
|
|
|
147 |
|
|
set_interface_property spi ENABLED true
|
148 |
|
|
|
149 |
|
|
add_interface_port spi MOSI export Output 1
|
150 |
|
|
add_interface_port spi SCLK export Output 1
|
151 |
|
|
add_interface_port spi MISO export Input 1
|
152 |
|
|
# |
|
153 |
|
|
# +-----------------------------------
|