soc_maker 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/History.txt +4 -0
  4. data/LICENSE +678 -0
  5. data/README.rdoc +228 -0
  6. data/Rakefile +46 -0
  7. data/bin/soc_maker_cli +80 -0
  8. data/bin/soc_maker_parser +85 -0
  9. data/core_lib/cores/adv_debug_sys/01_adv_debug_sys.yaml +245 -0
  10. data/core_lib/cores/or1200_rel2/01_or1200.yaml +208 -0
  11. data/core_lib/cores/or1200_rel2/02_or1200_files.yaml +421 -0
  12. data/core_lib/cores/or1200_rel2/03_or1200_sparam.yaml +188 -0
  13. data/core_lib/cores/or1200_rel2/or1200_defines.v.in +1799 -0
  14. data/core_lib/cores/ram_wb/ram_wb.yaml +102 -0
  15. data/core_lib/cores/ram_wb/ram_wb_b3.v.in +259 -0
  16. data/core_lib/cores/uart16550/01_uart16550.yaml +99 -0
  17. data/core_lib/cores/uart16550/02_uart16550_files.yaml +70 -0
  18. data/core_lib/cores/wb_connect/minsoc_tc_top.v +1802 -0
  19. data/core_lib/cores/wb_connect/wb_connect.yaml +733 -0
  20. data/core_lib/inc.yaml +13 -0
  21. data/core_lib/interfaces/clk_rst/clk.yaml +9 -0
  22. data/core_lib/interfaces/clk_rst/rst.yaml +9 -0
  23. data/core_lib/interfaces/clk_rst/single.yaml +7 -0
  24. data/core_lib/interfaces/debug/debug.yaml +32 -0
  25. data/core_lib/interfaces/jtag/jtag.yaml +13 -0
  26. data/core_lib/interfaces/jtag/jtag_tap.yaml +22 -0
  27. data/core_lib/interfaces/power/or_power.yaml +25 -0
  28. data/core_lib/interfaces/uart/uart.yaml +21 -0
  29. data/core_lib/interfaces/wishbone/wishbone_ma_b3.yaml +54 -0
  30. data/core_lib/interfaces/wishbone/wishbone_sl_b3.yaml +51 -0
  31. data/doc/class_arch.uml +5113 -0
  32. data/doc/fig/hierarchical.svg +273 -0
  33. data/examples/or1200_test/or1200_test.cmd +78 -0
  34. data/examples/or1200_test/or1200_test.rb +136 -0
  35. data/examples/or1200_test/rtl/or1200_test_top.vhd +274 -0
  36. data/examples/or1200_test/rtl/s3astarter.ucf +10 -0
  37. data/examples/or1200_test/rtl/xilinx_internal_jtag.v +438 -0
  38. data/examples/or1200_test/rtl/xilinx_internal_jtag_options.v +12 -0
  39. data/examples/or1200_test/sw/README.txt +35 -0
  40. data/examples/or1200_test/sw/bin2vmem.c +159 -0
  41. data/examples/or1200_test/sw/board.h +24 -0
  42. data/examples/or1200_test/sw/compile.sh +18 -0
  43. data/examples/or1200_test/sw/except.S +152 -0
  44. data/examples/or1200_test/sw/int.c +79 -0
  45. data/examples/or1200_test/sw/int.h +14 -0
  46. data/examples/or1200_test/sw/interconnect.h +17 -0
  47. data/examples/or1200_test/sw/interrupts.c +14 -0
  48. data/examples/or1200_test/sw/main.c +16 -0
  49. data/examples/or1200_test/sw/or1200.h +454 -0
  50. data/examples/or1200_test/sw/orp.ld +60 -0
  51. data/examples/or1200_test/sw/reset.S +112 -0
  52. data/examples/or1200_test/sw/support.c +123 -0
  53. data/examples/or1200_test/sw/support.h +33 -0
  54. data/examples/or1200_test/sw/tick.c +30 -0
  55. data/examples/or1200_test/sw/tick.h +2 -0
  56. data/examples/or1200_test/sw/uart.c +136 -0
  57. data/examples/or1200_test/sw/uart.h +126 -0
  58. data/lib/soc_maker.rb +324 -0
  59. data/lib/soc_maker/cli.rb +544 -0
  60. data/lib/soc_maker/conf.rb +310 -0
  61. data/lib/soc_maker/core_def.rb +579 -0
  62. data/lib/soc_maker/core_inst.rb +305 -0
  63. data/lib/soc_maker/err.rb +211 -0
  64. data/lib/soc_maker/hdl_coder.rb +500 -0
  65. data/lib/soc_maker/hdl_file.rb +166 -0
  66. data/lib/soc_maker/hdl_parser.rb +431 -0
  67. data/lib/soc_maker/ifc_def.rb +193 -0
  68. data/lib/soc_maker/ifc_port.rb +133 -0
  69. data/lib/soc_maker/ifc_spc.rb +180 -0
  70. data/lib/soc_maker/lib.rb +289 -0
  71. data/lib/soc_maker/lib_inc.rb +109 -0
  72. data/lib/soc_maker/parameter.rb +149 -0
  73. data/lib/soc_maker/soc_def.rb +847 -0
  74. data/lib/soc_maker/sparameter.rb +289 -0
  75. data/lib/soc_maker/version.rb +8 -0
  76. data/lib/soc_maker/ypp.rb +130 -0
  77. data/soc_maker.gemspec +28 -0
  78. data/spec/cli_cmds1.txt +39 -0
  79. data/spec/cli_spec.rb +49 -0
  80. data/spec/conf_spec.rb +44 -0
  81. data/spec/core_def_spec.rb +503 -0
  82. data/spec/core_inst_spec.rb +169 -0
  83. data/spec/hdl_file_spec.rb +154 -0
  84. data/spec/hdl_parser_spec.rb +201 -0
  85. data/spec/ifc_def_spec.rb +121 -0
  86. data/spec/ifc_port_spec.rb +92 -0
  87. data/spec/ifc_spc_spec.rb +196 -0
  88. data/spec/lib_inc_spec.rb +99 -0
  89. data/spec/lib_spec.rb +209 -0
  90. data/spec/parameter_spec.rb +86 -0
  91. data/spec/soc_def_spec.rb +611 -0
  92. data/spec/soc_maker_spec.rb +7 -0
  93. data/spec/sparameter_spec.rb +182 -0
  94. data/spec/spec_helper.rb +78 -0
  95. data/spec/test_soc.yaml +105 -0
  96. data/spec/test_soc2.yaml +60 -0
  97. data/spec/test_soc_lib/cores/core_A_rel1/00_core_a.yaml +75 -0
  98. data/spec/test_soc_lib/cores/core_A_rel1/01_core_a.yaml +57 -0
  99. data/spec/test_soc_lib/cores/core_A_rel1/core_a.vhd +29 -0
  100. data/spec/test_soc_lib/cores/core_A_rel1/core_a_pkg.vhd.src +3 -0
  101. data/spec/test_soc_lib/cores/core_A_rel1/core_a_pkg2.vhd.src +4 -0
  102. data/spec/test_soc_lib/cores/core_A_rel1/core_a_pkg3.v.src +6 -0
  103. data/spec/test_soc_lib/cores/core_B_rel1/core_b.vhd +25 -0
  104. data/spec/test_soc_lib/cores/core_B_rel1/core_b.yaml +36 -0
  105. data/spec/test_soc_lib/cores/core_C_v1/core_C.vhd +57 -0
  106. data/spec/test_soc_lib/cores/core_C_v1/core_c.yaml +42 -0
  107. data/spec/test_soc_lib/cores/soc_A/soc_A.yaml +12 -0
  108. data/spec/test_soc_lib/cores/soc_maker_include.yaml +6 -0
  109. data/spec/test_soc_lib/ifcs/core_AB_ifc/bidir_ifc.yaml +19 -0
  110. data/spec/test_soc_lib/ifcs/core_AB_ifc/core_AB_ifc.yaml +15 -0
  111. data/spec/test_soc_lib/ifcs/core_AB_ifc/top_ifc.yaml +9 -0
  112. data/spec/test_soc_lib/soc_maker_include.yaml +4 -0
  113. data/spec/yaml_examples.rb +367 -0
  114. data/spec/ypp_spec.rb +156 -0
  115. data/test/test_soc_maker.rb +0 -0
  116. metadata +255 -0
@@ -0,0 +1,274 @@
1
+ library IEEE;
2
+ use IEEE.STD_LOGIC_1164.ALL;
3
+ Library UNISIM;
4
+ use UNISIM.vcomponents.all;
5
+
6
+ entity or1200_test_top is
7
+ Port ( CLK_50M : in STD_LOGIC;
8
+ BTN_SOUTH : in STD_LOGIC;
9
+ RS232_DCE_RXD : in STD_LOGIC;
10
+ RS232_DCE_TXD : out STD_LOGIC
11
+ );
12
+ end or1200_test_top;
13
+
14
+ architecture Behavioral of or1200_test_top is
15
+
16
+ constant VPI_TAP : boolean := false;
17
+
18
+
19
+ component dbg_comm_vpi is
20
+ Port(
21
+ SYS_CLK : out STD_LOGIC;
22
+ SYS_RST : out STD_LOGIC;
23
+ P_TMS : out STD_LOGIC;
24
+ P_TCK : out STD_LOGIC;
25
+ P_TRST : out STD_LOGIC;
26
+ P_TDI : out STD_LOGIC;
27
+ P_TDO : in STD_LOGIC
28
+ );
29
+ end component;
30
+ signal P_TMS : STD_LOGIC;
31
+ signal P_TCK : STD_LOGIC;
32
+ signal P_TRST : STD_LOGIC;
33
+ signal P_TDI : STD_LOGIC;
34
+ signal P_TDO : STD_LOGIC;
35
+
36
+
37
+
38
+ component or1200_test is
39
+ port(
40
+ clk_i : in std_logic ;
41
+ rst_i : in std_logic ;
42
+ tck_i : in std_logic ;
43
+ tdi_i : in std_logic ;
44
+ tdo_o : out std_logic ;
45
+ debug_rst_i : in std_logic ;
46
+ shift_dr_i : in std_logic ;
47
+ pause_dr_i : in std_logic ;
48
+ update_dr_i : in std_logic ;
49
+ capture_dr_i : in std_logic ;
50
+ debug_select_i : in std_logic;
51
+ stx_pad_o : out std_logic ;
52
+ srx_pad_i : in std_logic ;
53
+ rts_pad_o : out std_logic ;
54
+ cts_pad_i : in std_logic ;
55
+ dtr_pad_o : out std_logic ;
56
+ dsr_pad_i : in std_logic ;
57
+ ri_pad_i : in std_logic ;
58
+ dcd_pad_i : in std_logic
59
+ );
60
+ end component;
61
+
62
+ component tap_top is
63
+ port (
64
+
65
+ -- JTAG pads
66
+ signal tms_pad_i : in std_logic;
67
+ signal tck_pad_i : in std_logic;
68
+ signal trstn_pad_i : in std_logic;
69
+ signal tdi_pad_i : in std_logic;
70
+ signal tdo_pad_o : out std_logic;
71
+ signal tdo_padoe_o : out std_logic;
72
+
73
+ -- TAP states
74
+ signal test_logic_reset_o : out std_logic;
75
+ signal run_test_idle_o : out std_logic;
76
+ signal shift_dr_o : out std_logic;
77
+ signal pause_dr_o : out std_logic;
78
+ signal update_dr_o : out std_logic;
79
+ signal capture_dr_o : out std_logic;
80
+
81
+ -- Select signals for boundary scan or mbist
82
+ signal extest_select_o : out std_logic;
83
+ signal sample_preload_select_o : out std_logic;
84
+ signal mbist_select_o : out std_logic;
85
+ signal debug_select_o : out std_logic;
86
+
87
+ -- TDO signal that is connected to TDI of sub-modules.
88
+ signal tdi_o : out std_logic;
89
+
90
+ -- TDI signals from sub-modules
91
+ signal debug_tdo_i : in std_logic; -- from debug module
92
+ signal bs_chain_tdo_i : in std_logic; -- from Boundary Scan Chain
93
+ signal mbist_tdo_i : in std_logic -- from Mbist Chain
94
+ );
95
+ end component;
96
+
97
+ component xilinx_internal_jtag is
98
+ port(
99
+ signal tck_o : out std_logic;
100
+ signal debug_tdo_i : in std_logic;
101
+ signal tdi_o : out std_logic;
102
+ signal test_logic_reset_o : out std_logic;
103
+ signal run_test_idle_o : out std_logic;
104
+ signal shift_dr_o : out std_logic;
105
+ signal capture_dr_o : out std_logic;
106
+ signal pause_dr_o : out std_logic;
107
+ signal update_dr_o : out std_logic;
108
+ signal debug_select_o : out std_logic
109
+ );
110
+ end component;
111
+
112
+
113
+
114
+ signal clk_i : std_logic ;
115
+ signal rst_i : std_logic ;
116
+ signal n_rst_i : std_logic ;
117
+ signal tck_i : std_logic ;
118
+ signal tdi_i : std_logic ;
119
+ signal tdo_o : std_logic ;
120
+ signal shift_dr_i : std_logic ;
121
+ signal pause_dr_i : std_logic ;
122
+ signal update_dr_i : std_logic ;
123
+ signal capture_dr_i : std_logic ;
124
+ signal debug_select_i : std_logic ;
125
+ signal debug_rst_i : std_logic ;
126
+ signal stx_pad_o : std_logic ;
127
+ signal srx_pad_i : std_logic ;
128
+ signal rts_pad_o : std_logic ;
129
+ signal cts_pad_i : std_logic ;
130
+ signal dtr_pad_o : std_logic ;
131
+ signal dsr_pad_i : std_logic ;
132
+ signal ri_pad_i : std_logic ;
133
+ signal dcd_pad_i : std_logic ;
134
+ signal gnd : std_logic;
135
+
136
+ signal VPI_CLK : std_logic;
137
+
138
+ begin
139
+
140
+ gnd <= '0';
141
+ srx_pad_i <= RS232_DCE_RXD;
142
+ RS232_DCE_TXD <= stx_pad_o;
143
+ cts_pad_i <= '0';
144
+ dsr_pad_i <= '0';
145
+ dcd_pad_i <= '0';
146
+ ri_pad_i <= '0';
147
+
148
+
149
+
150
+
151
+ --
152
+ -- Simulation Part:
153
+ -- The VPI and Standard JTAG TAP is used
154
+ --
155
+ VPI_SEL : if VPI_TAP = true generate
156
+
157
+
158
+ -- clk_i <= CLK_50M;
159
+ rst_i <= BTN_SOUTH;
160
+ n_rst_i <= not rst_i;
161
+
162
+
163
+ --
164
+ -- Debug VPI
165
+ --
166
+ vpi : dbg_comm_vpi
167
+ port map(
168
+ SYS_CLK => clk_i,
169
+ P_TMS => P_TMS ,
170
+ P_TCK => P_TCK ,
171
+ P_TRST => P_TRST ,
172
+ P_TDI => P_TDI ,
173
+ P_TDO => P_TDO );
174
+
175
+ --
176
+ -- Standard JTAG TAP
177
+ --
178
+ tap_inst : tap_top
179
+ port map(
180
+
181
+ -- JTAG pads: this 6 signals simulates
182
+ -- the physical connection to the tap
183
+ tms_pad_i => P_TMS,
184
+ tck_pad_i => P_TCK,
185
+ trstn_pad_i => n_rst_i,
186
+ tdi_pad_i => P_TDI,
187
+ tdo_pad_o => P_TDO,
188
+ tdo_padoe_o => open,
189
+
190
+ -- TAP states
191
+ test_logic_reset_o => debug_rst_i,
192
+ run_test_idle_o => open,
193
+ shift_dr_o => shift_dr_i,
194
+ pause_dr_o => pause_dr_i,
195
+ update_dr_o => update_dr_i,
196
+ capture_dr_o => capture_dr_i,
197
+
198
+ -- Select signals for boundary scan or mbist
199
+ extest_select_o => open,
200
+ sample_preload_select_o => open,
201
+ mbist_select_o => open,
202
+ debug_select_o => debug_select_i,
203
+
204
+ -- TDO signal that is connected to TDI of sub-modules.
205
+ tdi_o => tdi_i,
206
+
207
+ -- TDI signals from sub-modules
208
+ debug_tdo_i => tdo_o,
209
+ bs_chain_tdo_i => gnd,
210
+ mbist_tdo_i => gnd
211
+ );
212
+
213
+ tck_i <= P_TCK;
214
+
215
+
216
+
217
+ end generate VPI_SEL;
218
+
219
+ --
220
+ -- Synthesis Part:
221
+ -- The FPGA internal Xilinx TAP is used
222
+ --
223
+ NO_VPI_SEL : if VPI_TAP = false generate
224
+
225
+ clk_i <= CLK_50M;
226
+ rst_i <= BTN_SOUTH;
227
+ n_rst_i <= not rst_i;
228
+
229
+ tap_inst_xilinx : xilinx_internal_jtag
230
+ port map(
231
+ tck_o => tck_i,
232
+ debug_tdo_i => tdo_o,
233
+ tdi_o => tdi_i,
234
+ test_logic_reset_o => debug_rst_i,
235
+ run_test_idle_o => open,
236
+ shift_dr_o => shift_dr_i,
237
+ capture_dr_o => capture_dr_i,
238
+ pause_dr_o => pause_dr_i,
239
+ update_dr_o => update_dr_i,
240
+ debug_select_o => debug_select_i
241
+ );
242
+
243
+ end generate NO_VPI_SEL;
244
+
245
+
246
+ --
247
+ -- The SOC instance
248
+ --
249
+ top : or1200_test
250
+ port map(
251
+ clk_i => clk_i ,
252
+ rst_i => rst_i ,
253
+ tck_i => tck_i ,
254
+ tdi_i => tdi_i ,
255
+ tdo_o => tdo_o ,
256
+ debug_rst_i => debug_rst_i ,
257
+ shift_dr_i => shift_dr_i ,
258
+ pause_dr_i => pause_dr_i ,
259
+ update_dr_i => update_dr_i ,
260
+ capture_dr_i => capture_dr_i ,
261
+ debug_select_i => debug_select_i ,
262
+ stx_pad_o => stx_pad_o ,
263
+ srx_pad_i => srx_pad_i ,
264
+ rts_pad_o => rts_pad_o ,
265
+ cts_pad_i => cts_pad_i ,
266
+ dtr_pad_o => dtr_pad_o ,
267
+ dsr_pad_i => dsr_pad_i ,
268
+ ri_pad_i => ri_pad_i ,
269
+ dcd_pad_i => dcd_pad_i
270
+ );
271
+
272
+
273
+ end Behavioral;
274
+
@@ -0,0 +1,10 @@
1
+ CONFIG VCCAUX = "3.3" ;
2
+ CONFIG ENABLE_SUSPEND = "FILTERED" ;
3
+ CONFIG POST_CRC = "DISABLE" ;
4
+ NET "CLK_50M" LOC = "E12" | IOSTANDARD = LVCMOS33 | PERIOD = 20.000 ;
5
+ OFFSET = IN 10.000 VALID 20.000 BEFORE "CLK_50M" ;
6
+ OFFSET = OUT 20.000 AFTER "CLK_50M" ;
7
+ NET "BTN_SOUTH" LOC = "T15" | IOSTANDARD = LVCMOS33 | PULLDOWN ;
8
+ NET "RS232_DCE_RXD" LOC = "E16" | IOSTANDARD = LVCMOS33 ;
9
+ NET "RS232_DCE_TXD" LOC = "F15" | IOSTANDARD = LVCMOS33 | DRIVE = 8 | SLEW = SLOW ;
10
+
@@ -0,0 +1,438 @@
1
+ ///////////////////////////////////////////////////////////////////////
2
+ //// ////
3
+ //// xilinx_internal_jtag.v ////
4
+ //// ////
5
+ //// ////
6
+ //// ////
7
+ //// Author(s): ////
8
+ //// Nathan Yawn (nathan.yawn@opencores.org) ////
9
+ //// ////
10
+ //// ////
11
+ //// ////
12
+ //////////////////////////////////////////////////////////////////////
13
+ //// ////
14
+ //// Copyright (C) 2008 Authors ////
15
+ //// ////
16
+ //// This source file may be used and distributed without ////
17
+ //// restriction provided that this copyright statement is not ////
18
+ //// removed from the file and that any derivative work contains ////
19
+ //// the original copyright notice and the associated disclaimer. ////
20
+ //// ////
21
+ //// This source file is free software; you can redistribute it ////
22
+ //// and/or modify it under the terms of the GNU Lesser General ////
23
+ //// Public License as published by the Free Software Foundation; ////
24
+ //// either version 2.1 of the License, or (at your option) any ////
25
+ //// later version. ////
26
+ //// ////
27
+ //// This source is distributed in the hope that it will be ////
28
+ //// useful, but WITHOUT ANY WARRANTY; without even the implied ////
29
+ //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
30
+ //// PURPOSE. See the GNU Lesser General Public License for more ////
31
+ //// details. ////
32
+ //// ////
33
+ //// You should have received a copy of the GNU Lesser General ////
34
+ //// Public License along with this source; if not, download it ////
35
+ //// from http://www.opencores.org/lgpl.shtml ////
36
+ //// ////
37
+ //////////////////////////////////////////////////////////////////////
38
+ // //
39
+ // This file is a wrapper for the various Xilinx internal BSCAN //
40
+ // TAP devices. It is designed to take the place of a separate TAP //
41
+ // controller in Xilinx systems, to allow a user to access a CPU //
42
+ // debug module (such as that of the OR1200) through the FPGA's //
43
+ // dedicated JTAG / configuration port. //
44
+ // //
45
+ //////////////////////////////////////////////////////////////////////
46
+ //
47
+ // CVS Revision History
48
+ //
49
+ // $Log: xilinx_internal_jtag.v,v $
50
+ // Revision 1.4 2009-12-28 01:15:28 Nathan
51
+ // Removed incorrect duplicate assignment of capture_dr_o in SPARTAN2 TAP, per bug report from Raul Fajardo.
52
+ //
53
+ // Revision 1.3 2009/06/16 02:54:23 Nathan
54
+ // Changed some signal names for better consistency between different hardware modules.
55
+ //
56
+ // Revision 1.2 2009/05/17 20:54:16 Nathan
57
+ // Changed email address to opencores.org
58
+ //
59
+ // Revision 1.1 2008/07/18 20:07:32 Nathan
60
+ // Changed the directory structure to match existing projects.
61
+ //
62
+ // Revision 1.4 2008/07/11 08:26:10 Nathan
63
+ // Ran through dos2unix
64
+ //
65
+ // Revision 1.3 2008/07/11 08:25:52 Nathan
66
+ // Added logic to provide CAPTURE_DR signal when necessary, and to provide a TCK while UPDATE_DR is asserted. Note that there is no TCK event between SHIFT_DR and UPDATE_DR, and no TCK event between UPDATE_DR and the next CAPTURE_DR; the Xilinx BSCAN devices do not provide it. Tested successfully with the adv_dbg_if on Virtex-4.
67
+ //
68
+ // Revision 1.2 2008/06/09 19:34:14 Nathan
69
+ // Syntax and functional fixes made after compiling each type of BSCAN module using Xilinx tools.
70
+ //
71
+ // Revision 1.1 2008/05/22 19:54:07 Nathan
72
+ // Initial version
73
+ //
74
+
75
+
76
+ `include "xilinx_internal_jtag_options.v"
77
+
78
+ // Note that the SPARTAN BSCAN controllers have more than one channel.
79
+ // This implementation always uses channel 1, this is not configurable.
80
+ // If you want to use another channel, then it is probably because you
81
+ // want to attach multiple devices to the BSCAN device, which means
82
+ // you'll be making changes to this file anyway.
83
+ // Virtex BSCAN devices are instantiated separately for each channel.
84
+ // To select something other than the default (1), change the parameter
85
+ // "virtex_jtag_chain".
86
+
87
+
88
+ module xilinx_internal_jtag (
89
+ tck_o,
90
+ debug_tdo_i,
91
+ tdi_o,
92
+ test_logic_reset_o,
93
+ run_test_idle_o,
94
+ shift_dr_o,
95
+ capture_dr_o,
96
+ pause_dr_o,
97
+ update_dr_o,
98
+ debug_select_o
99
+ );
100
+
101
+ // May be 1, 2, 3, or 4
102
+ // Only used for Virtex 4/5 devices
103
+ parameter virtex_jtag_chain = 1;
104
+
105
+ input debug_tdo_i;
106
+ output tck_o;
107
+ output tdi_o;
108
+ output test_logic_reset_o;
109
+ output run_test_idle_o;
110
+ output shift_dr_o;
111
+ output capture_dr_o;
112
+ output pause_dr_o;
113
+ output update_dr_o;
114
+ output debug_select_o;
115
+
116
+ wire debug_tdo_i;
117
+ wire tck_o;
118
+ wire drck;
119
+ wire tdi_o;
120
+ wire test_logic_reset_o;
121
+ wire run_test_idle_o;
122
+ wire shift_dr_o;
123
+ wire pause_dr_o;
124
+ wire update_dr_o;
125
+ wire debug_select_o;
126
+
127
+
128
+
129
+ `ifdef SPARTAN2
130
+
131
+ // Note that this version is missing three outputs.
132
+ // It also does not have a real TCK...DRCK1 is only active when USER1 is selected
133
+ // AND the TAP is in SHIFT_DR or CAPTURE_DR states...except there's no
134
+ // capture_dr output.
135
+
136
+ reg capture_dr_o;
137
+ wire update_bscan;
138
+ reg update_out;
139
+
140
+ BSCAN_SPARTAN2 BSCAN_SPARTAN2_inst (
141
+ .DRCK1(drck), // Data register output for USER1 functions
142
+ .DRCK2(), // Data register output for USER2 functions
143
+ .RESET(test_logic_reset_o), // Reset output from TAP controller
144
+ .SEL1(debug_select_o), // USER1 active output
145
+ .SEL2(), // USER2 active output
146
+ .SHIFT(shift_dr_o), // SHIFT output from TAP controller
147
+ .TDI(tdi_o), // TDI output from TAP controller
148
+ .UPDATE(update_bscan), // UPDATE output from TAP controller
149
+ .TDO1(debug_tdo_i), // Data input for USER1 function
150
+ .TDO2( 1'b0 ) // Data input for USER2 function
151
+ );
152
+
153
+ assign pause_dr_o = 1'b0;
154
+ assign run_test_idle_o = 1'b0;
155
+
156
+ // We get one TCK during capture_dr state (low,high,SHIFT goes high on next DRCK high)
157
+ // On that negative edge, set capture_dr, and it will get registered on the rising
158
+ // edge.
159
+ always @ (negedge tck_o)
160
+ begin
161
+ if(debug_select_o && !shift_dr_o)
162
+ capture_dr_o <= 1'b1;
163
+ else
164
+ capture_dr_o <= 1'b0;
165
+ end
166
+
167
+ // The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
168
+ // The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
169
+ // This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
170
+ assign tck_o = (drck & debug_select_o & !update_bscan);
171
+
172
+ // This will hold the update_dr output so it can be registered on the rising edge
173
+ // of the clock created above.
174
+ always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
175
+ begin
176
+ if(update_bscan) update_out <= 1'b1;
177
+ else if(capture_dr_o) update_out <= 1'b0;
178
+ else if(!debug_select_o) update_out <= 1'b0;
179
+ end
180
+
181
+ assign update_dr_o = update_out;
182
+
183
+ `else
184
+ `ifdef SPARTAN3
185
+ // Note that this version is missing two outputs.
186
+ // It also does not have a real TCK...DRCK1 is only active when USER1 is selected.
187
+
188
+ wire capture_dr_o;
189
+ wire update_bscan;
190
+ reg update_out;
191
+
192
+ BSCAN_SPARTAN3 BSCAN_SPARTAN3_inst (
193
+ .CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
194
+ .DRCK1(drck), // Data register output for USER1 functions
195
+ .DRCK2(), // Data register output for USER2 functions
196
+ .RESET(test_logic_reset_o), // Reset output from TAP controller
197
+ .SEL1(debug_select_o), // USER1 active output
198
+ .SEL2(), // USER2 active output
199
+ .SHIFT(shift_dr_o), // SHIFT output from TAP controller
200
+ .TDI(tdi_o), // TDI output from TAP controller
201
+ .UPDATE(update_bscan), // UPDATE output from TAP controller
202
+ .TDO1(debug_tdo_i), // Data input for USER1 function
203
+ .TDO2(1'b0) // Data input for USER2 function
204
+ );
205
+
206
+ assign pause_dr_o = 1'b0;
207
+ assign run_test_idle_o = 1'b0;
208
+
209
+ // The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
210
+ // The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
211
+ // This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
212
+ assign tck_o = (drck & debug_select_o & !update_bscan);
213
+
214
+ // This will hold the update_dr output so it can be registered on the rising edge
215
+ // of the clock created above.
216
+ always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
217
+ begin
218
+ if(update_bscan) update_out <= 1'b1;
219
+ else if(capture_dr_o) update_out <= 1'b0;
220
+ else if(!debug_select_o) update_out <= 1'b0;
221
+ end
222
+
223
+ assign update_dr_o = update_out;
224
+
225
+ `else
226
+ `ifdef SPARTAN3A
227
+ // Note that this version is missing two outputs.
228
+ // At least it has a real TCK.
229
+
230
+ wire capture_dr_o;
231
+
232
+ BSCAN_SPARTAN3A BSCAN_SPARTAN3A_inst (
233
+ .CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
234
+ .DRCK1(), // Data register output for USER1 functions
235
+ .DRCK2(), // Data register output for USER2 functions
236
+ .RESET(test_logic_reset_o), // Reset output from TAP controller
237
+ .SEL1(debug_select_o), // USER1 active output
238
+ .SEL2(), // USER2 active output
239
+ .SHIFT(shift_dr_o), // SHIFT output from TAP controller
240
+ .TCK(tck_o), // TCK output from TAP controller
241
+ .TDI(tdi_o), // TDI output from TAP controller
242
+ .TMS(), // TMS output from TAP controller
243
+ .UPDATE(update_dr_o), // UPDATE output from TAP controller
244
+ .TDO1(debug_tdo_i), // Data input for USER1 function
245
+ .TDO2( 1'b0) // Data input for USER2 function
246
+ );
247
+
248
+ assign pause_dr_o = 1'b0;
249
+ assign run_test_idle_o = 1'b0;
250
+
251
+ `else
252
+ `ifdef VIRTEX
253
+
254
+ // Note that this version is missing three outputs.
255
+ // It also does not have a real TCK...DRCK1 is only active when USER1 is selected.
256
+
257
+ reg capture_dr_o;
258
+ wire update_bscan;
259
+ reg update_out;
260
+
261
+ BSCAN_VIRTEX BSCAN_VIRTEX_inst (
262
+ .DRCK1(drck), // Data register output for USER1 functions
263
+ .DRCK2(), // Data register output for USER2 functions
264
+ .RESET(test_logic_reset_o), // Reset output from TAP controller
265
+ .SEL1(debug_select_o), // USER1 active output
266
+ .SEL2(), // USER2 active output
267
+ .SHIFT(shift_dr_o), // SHIFT output from TAP controller
268
+ .TDI(tdi_o), // TDI output from TAP controller
269
+ .UPDATE(update_bscan), // UPDATE output from TAP controller
270
+ .TDO1(debug_tdo_i), // Data input for USER1 function
271
+ .TDO2( 1'b0) // Data input for USER2 function
272
+ );
273
+
274
+ assign pause_dr_o = 1'b0;
275
+ assign run_test_idle_o = 1'b0;
276
+
277
+ // We get one TCK during capture_dr state (low,high,SHIFT goes high on next DRCK low)
278
+ // On that negative edge, set capture_dr, and it will get registered on the rising
279
+ // edge, then de-asserted on the same edge that SHIFT goes high.
280
+ always @ (negedge tck_o)
281
+ begin
282
+ if(debug_select_o && !shift_dr_o)
283
+ capture_dr_o <= 1'b1;
284
+ else
285
+ capture_dr_o <= 1'b0;
286
+ end
287
+
288
+ // The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
289
+ // The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
290
+ // This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
291
+ assign tck_o = (drck & debug_select_o & !update_bscan);
292
+
293
+ // This will hold the update_dr output so it can be registered on the rising edge
294
+ // of the clock created above.
295
+ always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
296
+ begin
297
+ if(update_bscan) update_out <= 1'b1;
298
+ else if(capture_dr_o) update_out <= 1'b0;
299
+ else if(!debug_select_o) update_out <= 1'b0;
300
+ end
301
+
302
+ assign update_dr_o = update_out;
303
+
304
+ `else
305
+ `ifdef VIRTEX2
306
+
307
+ // Note that this version is missing two outputs.
308
+ // It also does not have a real TCK...DRCK1 is only active when USER1 is selected.
309
+
310
+ wire capture_dr_o;
311
+ wire update_bscan;
312
+ reg update_out;
313
+
314
+ BSCAN_VIRTEX2 BSCAN_VIRTEX2_inst (
315
+ .CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
316
+ .DRCK1(drck), // Data register output for USER1 functions
317
+ .DRCK2(), // Data register output for USER2 functions
318
+ .RESET(test_logic_reset_o), // Reset output from TAP controller
319
+ .SEL1(debug_select_o), // USER1 active output
320
+ .SEL2(), // USER2 active output
321
+ .SHIFT(shift_dr_o), // SHIFT output from TAP controller
322
+ .TDI(tdi_o), // TDI output from TAP controller
323
+ .UPDATE(update_bscan), // UPDATE output from TAP controller
324
+ .TDO1(debug_tdo_i), // Data input for USER1 function
325
+ .TDO2( 1'b0 ) // Data input for USER2 function
326
+ );
327
+
328
+ assign pause_dr_o = 1'b0;
329
+ assign run_test_idle_o = 1'b0;
330
+
331
+ // The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
332
+ // The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
333
+ // This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
334
+ assign tck_o = (drck & debug_select_o & !update_bscan);
335
+
336
+ // This will hold the update_dr output so it can be registered on the rising edge
337
+ // of the clock created above.
338
+ always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
339
+ begin
340
+ if(update_bscan) update_out <= 1'b1;
341
+ else if(capture_dr_o) update_out <= 1'b0;
342
+ else if(!debug_select_o) update_out <= 1'b0;
343
+ end
344
+
345
+ assign update_dr_o = update_out;
346
+
347
+ `else
348
+ `ifdef VIRTEX4
349
+ // Note that this version is missing two outputs.
350
+ // It also does not have a real TCK...DRCK is only active when USERn is selected.
351
+
352
+ wire capture_dr_o;
353
+ wire update_bscan;
354
+ reg update_out;
355
+
356
+ BSCAN_VIRTEX4 #(
357
+ .JTAG_CHAIN(virtex_jtag_chain)
358
+ ) BSCAN_VIRTEX4_inst (
359
+ .CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
360
+ .DRCK(drck), // Data register output for USER function
361
+ .RESET(test_logic_reset_o), // Reset output from TAP controller
362
+ .SEL(debug_select_o), // USER active output
363
+ .SHIFT(shift_dr_o), // SHIFT output from TAP controller
364
+ .TDI(tdi_o), // TDI output from TAP controller
365
+ .UPDATE(update_bscan), // UPDATE output from TAP controller
366
+ .TDO( debug_tdo_i ) // Data input for USER function
367
+ );
368
+
369
+ assign pause_dr_o = 1'b0;
370
+ assign run_test_idle_o = 1'b0;
371
+
372
+ // The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
373
+ // The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
374
+ // This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
375
+ assign tck_o = (drck & debug_select_o & !update_bscan);
376
+
377
+ // This will hold the update_dr output so it can be registered on the rising edge
378
+ // of the clock created above.
379
+ always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
380
+ begin
381
+ if(update_bscan) update_out <= 1'b1;
382
+ else if(capture_dr_o) update_out <= 1'b0;
383
+ else if(!debug_select_o) update_out <= 1'b0;
384
+ end
385
+
386
+ assign update_dr_o = update_out;
387
+
388
+ `else
389
+ `ifdef VIRTEX5
390
+ // Note that this version is missing two outputs.
391
+ // It also does not have a real TCK...DRCK is only active when USERn is selected.
392
+
393
+ wire capture_dr_o;
394
+ wire update_bscan;
395
+ reg update_out;
396
+
397
+ BSCAN_VIRTEX5 #(
398
+ .JTAG_CHAIN(virtex_jtag_chain)
399
+ ) BSCAN_VIRTEX5_inst (
400
+ .CAPTURE(capture_dr_o), // CAPTURE output from TAP controller
401
+ .DRCK(drck), // Data register output for USER function
402
+ .RESET(test_logic_reset), // Reset output from TAP controller
403
+ .SEL(debug_select_o), // USER active output
404
+ .SHIFT(shift_dr_o), // SHIFT output from TAP controller
405
+ .TDI(tdi_o), // TDI output from TAP controller
406
+ .UPDATE(update_bscan), // UPDATE output from TAP controller
407
+ .TDO(debug_tdo_i) // Data input for USER function
408
+ );
409
+
410
+ assign pause_dr_o = 1'b0;
411
+ assign run_test_idle_o = 1'b0;
412
+
413
+ // The & !update_bscan tern will provide a clock edge so update_dr_o can be registered
414
+ // The &debug_select term will drop TCK when the module is un-selected (does not happen in the BSCAN block).
415
+ // This allows a user to kludge clock ticks in the IDLE state, which is needed by the advanced debug module.
416
+ assign tck_o = (drck & debug_select_o & !update_bscan);
417
+
418
+ // This will hold the update_dr output so it can be registered on the rising edge
419
+ // of the clock created above.
420
+ always @(posedge update_bscan or posedge capture_dr_o or negedge debug_select_o)
421
+ begin
422
+ if(update_bscan) update_out <= 1'b1;
423
+ else if(capture_dr_o) update_out <= 1'b0;
424
+ else if(!debug_select_o) update_out <= 1'b0;
425
+ end
426
+
427
+ assign update_dr_o = update_out;
428
+
429
+
430
+ `endif
431
+ `endif
432
+ `endif
433
+ `endif
434
+ `endif
435
+ `endif
436
+ `endif
437
+
438
+ endmodule