Projektdaten für das ESY1B Praktikum im Sommersemester 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

spi_interface.sv 41KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. /*******************************************************************************
  2. Verilog netlist generated by IPGEN Lattice Radiant Software (64-bit)
  3. 3.1.1.232.1
  4. Soft IP Version: 1.0.0
  5. 2022 05 31 12:27:15
  6. *******************************************************************************/
  7. /*******************************************************************************
  8. SPI Interface Ports
  9. trying to follow instructions from:
  10. https://www.chipverify.com/systemverilog/systemverilog-interface
  11. *******************************************************************************/
  12. interface spi_interface_ports (input clk);
  13. // Connection to BUS side (internal)
  14. // Inputs from BUS
  15. logic sb_clk_i; // Clock
  16. logic sb_stb_i; // Chip Select from FRAM-Controller who is SPI-Master
  17. logic sb_wr_i; // Write/Read from FRAM-Controller
  18. logic sb_adr_i[7:0]; // Adddress from FRAM-Controller
  19. logic sb_dat_i[7:0]; // Data in from FRAM-Controller
  20. // Outputs to BUS
  21. logic sb_dat_o[7:0]; // Data out to FRAM-Controller
  22. logic sb_ack_o; // ACK to FRAM-Controller
  23. // Connection to SPI side (external)
  24. logic spi1_mosi_io; // MasterOutSlaveIn --> Master to Slave
  25. logic spi1_miso_io; // MasterInSlaveOut --> Slave to Master
  26. logic spi1_mcs_n_o[3:0]; // MasterChipSelect --> Master selects Slave
  27. logic spi1_sck_io; // Clock for SPI-Slave
  28. // MODPORT form BUS perspective (internal)
  29. // modport input and output from BUS (internal)
  30. modport BUS (output sb_clk_i, sb_stb_i, sb_wr_i, sb_adr_i, sb_dat_i, spi1_miso_io, input sb_dat_o, sb_ack_o, spi1_mosi_io, spi1_mcs_n_o, spi1_sck_io);
  31. // MODPORT from SPI perspective (external)
  32. // modport input and output from SPI (external)
  33. modport SPI (output spi1_miso_io, input spi1_mosi_io, spi1_mcs_n_o, spi1_sck_io);
  34. endinterface
  35. /*******************************************************************************
  36. Wrapper Module generated per user settings.
  37. *******************************************************************************/
  38. module spi_interface (spi1_miso_io,
  39. spi1_mosi_io,
  40. spi1_sck_io,
  41. spi1_scs_n_i,
  42. spi1_mcs_n_o,
  43. rst_i,
  44. ipload_i,
  45. ipdone_o,
  46. sb_clk_i,
  47. sb_wr_i,
  48. sb_stb_i,
  49. sb_adr_i,
  50. sb_dat_i,
  51. sb_dat_o,
  52. sb_ack_o,
  53. spi_pirq_o,
  54. spi_pwkup_o) ;
  55. inout spi1_miso_io ;
  56. inout spi1_mosi_io ;
  57. inout spi1_sck_io ;
  58. input spi1_scs_n_i ;
  59. output [3:0] spi1_mcs_n_o ;
  60. input rst_i ;
  61. input ipload_i ;
  62. output ipdone_o ;
  63. input sb_clk_i ;
  64. input sb_wr_i ;
  65. input sb_stb_i ;
  66. input [7:0] sb_adr_i ;
  67. input [7:0] sb_dat_i ;
  68. output [7:0] sb_dat_o ;
  69. output sb_ack_o ;
  70. output [1:0] spi_pirq_o ;
  71. output [1:0] spi_pwkup_o ;
  72. spi_interface_ipgen_lscc_spi_i2c #(.i2c_left_enable(0),
  73. .i2c_right_enable(0),
  74. .spi_left_enable(0),
  75. .spi_right_enable(1),
  76. .FREQUENCY_PIN_SBCLKI("12.0"),
  77. .I2C_LEFT_CLK_PRESCALE("29"),
  78. .I2C_LEFT_CLK_DIVIDER(120),
  79. .I2C_LEFT_SLAVE_INIT_ADDR("0b1111101"),
  80. .I2C_LEFT_SDA_INPUT_DELAYED("1"),
  81. .I2C_LEFT_SDA_OUTPUT_DELAYED("0"),
  82. .I2C_LEFT_INIT_VALUE_0(128),
  83. .I2C_LEFT_INIT_VALUE_1(31),
  84. .I2C_LEFT_INIT_VALUE_2(0),
  85. .I2C_RIGHT_CLK_PRESCALE("29"),
  86. .I2C_RIGHT_CLK_DIVIDER(120),
  87. .I2C_RIGHT_SLAVE_INIT_ADDR("0b1111110"),
  88. .I2C_RIGHT_SDA_INPUT_DELAYED("1"),
  89. .I2C_RIGHT_SDA_OUTPUT_DELAYED("0"),
  90. .I2C_RIGHT_INIT_VALUE_5(128),
  91. .I2C_RIGHT_INIT_VALUE_6(31),
  92. .I2C_RIGHT_INIT_VALUE_7(0),
  93. .SPI_LEFT_CLK_DIVIDER(1),
  94. .SPI_LEFT_CLK_PRESCALE("0"),
  95. .SPI_LEFT_MASTER_CHIP_SELECTS(1),
  96. .SPI_LEFT_WAKEUP_ENABLE(1),
  97. .SPI_LEFT_INIT_VALUE_10(8),
  98. .SPI_LEFT_INIT_VALUE_13(0),
  99. .SPI_RIGHT_CLK_DIVIDER(1),
  100. .SPI_RIGHT_CLK_PRESCALE("0"),
  101. .SPI_RIGHT_MASTER_CHIP_SELECTS(3),
  102. .SPI_RIGHT_WAKEUP_ENABLE(0),
  103. .SPI_RIGHT_INIT_VALUE_15(12),
  104. .SPI_RIGHT_INIT_VALUE_18(128)) lscc_spi_i2c_inst (.i2c2_scl_io(),
  105. .i2c2_sda_io(),
  106. .i2c1_scl_io(),
  107. .i2c1_sda_io(),
  108. .spi2_miso_io(),
  109. .spi2_mosi_io(),
  110. .spi2_sck_io(),
  111. .spi2_scs_n_i(1'b0),
  112. .spi2_mcs_n_o(),
  113. .spi1_miso_io(spi1_miso_io),
  114. .spi1_mosi_io(spi1_mosi_io),
  115. .spi1_sck_io(spi1_sck_io),
  116. .spi1_scs_n_i(spi1_scs_n_i),
  117. .spi1_mcs_n_o(spi1_mcs_n_o[3:0]),
  118. .rst_i(rst_i),
  119. .ipload_i(ipload_i),
  120. .ipdone_o(ipdone_o),
  121. .sb_clk_i(sb_clk_i),
  122. .sb_wr_i(sb_wr_i),
  123. .sb_stb_i(sb_stb_i),
  124. .sb_adr_i(sb_adr_i[7:0]),
  125. .sb_dat_i(sb_dat_i[7:0]),
  126. .sb_dat_o(sb_dat_o[7:0]),
  127. .sb_ack_o(sb_ack_o),
  128. .i2c_pirq_o(),
  129. .i2c_pwkup_o(),
  130. .spi_pirq_o(spi_pirq_o[1:0]),
  131. .spi_pwkup_o(spi_pwkup_o[1:0])) ;
  132. endmodule
  133. `timescale 1ns/1ns
  134. // =============================================================================
  135. // >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  136. // -----------------------------------------------------------------------------
  137. // Copyright (c) 2017 by Lattice Semiconductor Corporation
  138. // ALL RIGHTS RESERVED
  139. // -----------------------------------------------------------------------------
  140. //
  141. // Permission:
  142. //
  143. // Lattice SG Pte. Ltd. grants permission to use this code
  144. // pursuant to the terms of the Lattice Reference Design License Agreement.
  145. //
  146. //
  147. // Disclaimer:
  148. //
  149. // This VHDL or Verilog source code is intended as a design reference
  150. // which illustrates how these types of functions can be implemented.
  151. // It is the user's responsibility to verify their design for
  152. // consistency and functionality through the use of formal
  153. // verification methods. Lattice provides no warranty
  154. // regarding the use or functionality of this code.
  155. //
  156. // -----------------------------------------------------------------------------
  157. //
  158. // Lattice SG Pte. Ltd.
  159. // 101 Thomson Road, United Square #07-02
  160. // Singapore 307591
  161. //
  162. //
  163. // TEL: 1-800-Lattice (USA and Canada)
  164. // +65-6631-2000 (Singapore)
  165. // +1-503-268-8001 (other locations)
  166. //
  167. // web: http://www.latticesemi.com/
  168. // email: techsupport@latticesemi.com
  169. //
  170. // -----------------------------------------------------------------------------
  171. //
  172. // =============================================================================
  173. // FILE DETAILS
  174. // Project :
  175. // File : lscc_spi_i2c.v
  176. // Title :
  177. // Dependencies : I2C_B primitive
  178. // : SPI_B primitive
  179. // Description :
  180. // =============================================================================
  181. // REVISION HISTORY
  182. // Version : 1.0.0.
  183. // Author(s) :
  184. // Mod. Date :
  185. // Changes Made : Initial release.
  186. // =============================================================================
  187. module spi_interface_ipgen_lscc_spi_i2c #(parameter num_regs = 23,
  188. parameter i2c_left_enable = 0,
  189. parameter i2c_right_enable = 0,
  190. parameter spi_left_enable = 0,
  191. parameter spi_right_enable = 0,
  192. parameter FREQUENCY_PIN_SBCLKI = "NONE",
  193. parameter I2C_LEFT_CLK_DIVIDER = 8,
  194. parameter I2C_LEFT_CLK_PRESCALE = "1",
  195. parameter I2C_LEFT_INIT_VALUE_0 = 0,
  196. parameter I2C_LEFT_INIT_VALUE_1 = 0,
  197. parameter I2C_LEFT_INIT_VALUE_2 = 0,
  198. parameter I2C_LEFT_SLAVE_INIT_ADDR = "0b1111100001",
  199. parameter I2C_LEFT_SDA_INPUT_DELAYED = "1",
  200. parameter I2C_LEFT_SDA_OUTPUT_DELAYED = "0",
  201. parameter I2C_RIGHT_CLK_DIVIDER = 8,
  202. parameter I2C_RIGHT_CLK_PRESCALE = "1",
  203. parameter I2C_RIGHT_INIT_VALUE_5 = 0,
  204. parameter I2C_RIGHT_INIT_VALUE_6 = 0,
  205. parameter I2C_RIGHT_INIT_VALUE_7 = 0,
  206. parameter I2C_RIGHT_SLAVE_INIT_ADDR = "0b1111100010",
  207. parameter I2C_RIGHT_SDA_INPUT_DELAYED = "1",
  208. parameter I2C_RIGHT_SDA_OUTPUT_DELAYED = "0",
  209. parameter SPI_LEFT_INIT_VALUE_10 = 0,
  210. parameter SPI_LEFT_INIT_VALUE_13 = 0,
  211. parameter SPI_RIGHT_INIT_VALUE_15 = 0,
  212. parameter SPI_RIGHT_INIT_VALUE_18 = 0,
  213. parameter SPI_LEFT_WAKEUP_ENABLE = 1,
  214. parameter SPI_LEFT_CLK_DIVIDER = 2,
  215. parameter SPI_LEFT_CLK_PRESCALE = "1",
  216. parameter SPI_LEFT_MASTER_CHIP_SELECTS = 1,
  217. parameter SPI_RIGHT_WAKEUP_ENABLE = 1,
  218. parameter SPI_RIGHT_CLK_DIVIDER = 2,
  219. parameter SPI_RIGHT_CLK_PRESCALE = "1",
  220. parameter SPI_RIGHT_MASTER_CHIP_SELECTS = 1) (
  221. // -----------------------------------------------------------------------------
  222. // Module Parameters
  223. // -----------------------------------------------------------------------------
  224. // (I2C_LEFT_CLK_PRESCALE+1) * 4
  225. // (1 - 1023)
  226. // (I2C_RIGHT_CLK_PRESCALE+1) * 4
  227. // (1 - 1023)
  228. // SPI_LEFT_CLK_PRESCALE + 1
  229. // (1 - 63)
  230. // SPI_RIGHT_CLK_PRESCALE + 1
  231. // (1 - 63)
  232. // -----------------------------------------------------------------------------
  233. // Input/Output Ports
  234. // -----------------------------------------------------------------------------
  235. // I2C Left
  236. inout wire i2c2_scl_io,
  237. inout wire i2c2_sda_io,
  238. // I2c Right
  239. inout wire i2c1_scl_io,
  240. inout wire i2c1_sda_io,
  241. // SPI Left
  242. inout wire spi2_miso_io,
  243. inout wire spi2_mosi_io,
  244. inout wire spi2_sck_io,
  245. input wire spi2_scs_n_i,
  246. output wire [3:0] spi2_mcs_n_o,
  247. // SPI Right
  248. inout wire spi1_miso_io,
  249. inout wire spi1_mosi_io,
  250. inout wire spi1_sck_io,
  251. input wire spi1_scs_n_i,
  252. output wire [3:0] spi1_mcs_n_o,
  253. // Fabric Interface
  254. input wire rst_i,
  255. input wire ipload_i,
  256. output wire ipdone_o,
  257. input wire sb_clk_i,
  258. input wire sb_wr_i,
  259. input wire sb_stb_i,
  260. input wire [7:0] sb_adr_i,
  261. input wire [7:0] sb_dat_i,
  262. output wire [7:0] sb_dat_o,
  263. output wire sb_ack_o,
  264. output wire [1:0] i2c_pirq_o,
  265. output wire [1:0] i2c_pwkup_o,
  266. output wire [1:0] spi_pirq_o,
  267. output wire [1:0] spi_pwkup_o) ;
  268. // -----------------------------------------------------------------------------
  269. // Local Parameters
  270. // -----------------------------------------------------------------------------
  271. localparam RSVD = 8'hFF ;
  272. // I2C Base Address
  273. localparam I2CBADDRL = 4'b0001 ; // I2C LEFT
  274. localparam I2CBADDRR = 4'b0011 ; // I2C RIGHT
  275. // I2C Register Address
  276. localparam I2CCR1 = 4'b1000 ; // I2C Control Register 1
  277. localparam I2CCMDR = 4'b1001 ; // I2C Command Register
  278. localparam I2CBRLSB = 4'b1010 ; // I2C Clock Presale register, LSB
  279. localparam I2CBRMSB = 4'b1011 ; // I2C Clock Presale register, MSB
  280. localparam I2CSR = 4'b1100 ; // I2C Status Register
  281. localparam I2CTXDR = 4'b1101 ; // I2C Transmitting Data Register
  282. localparam I2CRXDR = 4'b1110 ; // I2C Receiving Data Register
  283. localparam I2CGCDR = 4'b1111 ; // I2C General Call Information Register
  284. localparam I2CINTCR = 4'b0111 ; // I2C Interrupt Control Register
  285. localparam I2CINTSR = 4'b0110 ; // I2C Interrupt Status Register
  286. localparam I2CSADDR = 4'b0011 ; // I2C Slave address MSB
  287. // SPI Base Address
  288. localparam SPIBADDRL = 4'b0000 ; // SPI LEFT
  289. localparam SPIBADDRR = 4'b0010 ; // SPI RIGHT
  290. // SPI Register Address
  291. localparam SPICR0 = 4'b1000 ; // SPI Control Register0
  292. localparam SPICR1 = 4'b1001 ; // SPI Control Register1
  293. localparam SPICR2 = 4'b1010 ; // SPI Control Register2
  294. localparam SPIBR = 4'b1011 ; // SPI Baud Rate Register
  295. localparam SPISR = 4'b1100 ; // SPI Status Register
  296. localparam SPITXDR = 4'b1101 ; // SPI Transmitting Data Register
  297. localparam SPIRXDR = 4'b1110 ; // SPI Receiving Data Register
  298. localparam SPICSR = 4'b1111 ; // SPI Chip Select Mask for Master Mode
  299. localparam SPIINTCR = 4'b0111 ; // SPI Interrupt Control Register
  300. localparam SPIINTSR = 4'b0110 ; // SPI Interrupt Status Register
  301. // -----------------------------------------------------------------------------
  302. // Combinatorial/Sequential Registers
  303. // -----------------------------------------------------------------------------
  304. reg [7:0] SBDATo_i ;
  305. reg load_d1 ;
  306. reg load_d2 ;
  307. reg start ;
  308. reg pup ;
  309. reg run ;
  310. reg [5:0] trans_count ;
  311. reg IPDONE_i ;
  312. reg sb_idle ;
  313. reg strobe ;
  314. reg wb_we_ix ;
  315. reg wb_stb_ix ;
  316. reg [7:0] wb_adr_ix ;
  317. reg [7:0] wb_dat_ix ;
  318. reg [5:0] start_count ;
  319. reg [5:0] next_count ;
  320. // -----------------------------------------------------------------------------
  321. // Wire Declarations
  322. // -----------------------------------------------------------------------------
  323. wire hard_SBWRi ;
  324. wire hard_SBSTBi ;
  325. wire [7:0] hard_SBADRi ;
  326. wire [7:0] hard_SBDATi ;
  327. wire hard00_SBACKO ;
  328. wire hard01_SBACKO ;
  329. wire hard10_SBACKO ;
  330. wire hard11_SBACKO ;
  331. wire [3:0] hard_ACKs ;
  332. wire SBACKo_i ;
  333. wire [7:0] hard00_SBDATo ;
  334. wire [7:0] hard01_SBDATo ;
  335. wire [7:0] hard10_SBDATo ;
  336. wire [7:0] hard11_SBDATo ;
  337. wire ssm_SBWRi ;
  338. wire ssm_SBSTBi ;
  339. wire [7:0] ssm_SBADRi ;
  340. wire [7:0] ssm_SBDATi ;
  341. wire I2C2_SCLo ;
  342. wire I2C2_SCLoe ;
  343. wire I2C2_SCLi ;
  344. wire I2C2_SDAo ;
  345. wire I2C2_SDAoe ;
  346. wire I2C2_SDAi ;
  347. wire I2C1_SCLo ;
  348. wire I2C1_SCLoe ;
  349. wire I2C1_SCLi ;
  350. wire I2C1_SDAo ;
  351. wire I2C1_SDAoe ;
  352. wire I2C1_SDAi ;
  353. wire SPI2_SO ;
  354. wire SPI2_SOoe ;
  355. wire SPI2_MI ;
  356. wire SPI2_MO ;
  357. wire SPI2_MOoe ;
  358. wire SPI2_SI ;
  359. wire SPI2_SCKo ;
  360. wire SPI2_SCKoe ;
  361. wire SPI2_SCKi ;
  362. wire SPI2_SCSNi ;
  363. wire [3:0] SPI2_MCSNo ;
  364. wire [3:0] SPI2_MCSNoe ;
  365. wire SPI1_SO ;
  366. wire SPI1_SOoe ;
  367. wire SPI1_MI ;
  368. wire SPI1_MO ;
  369. wire SPI1_MOoe ;
  370. wire SPI1_SI ;
  371. wire SPI1_SCKo ;
  372. wire SPI1_SCKoe ;
  373. wire SPI1_SCKi ;
  374. wire SPI1_SCSNi ;
  375. wire [3:0] SPI1_MCSNo ;
  376. wire [3:0] SPI1_MCSNoe ;
  377. wire [7:0] init_value [0:(num_regs - 1)] ;
  378. wire [7:0] init_addr [0:(num_regs - 1)] ;
  379. wire [11:0] i2c_left_prescale ;
  380. wire [11:0] i2c_right_prescale ;
  381. // -----------------------------------------------------------------------------
  382. // Assign Statements
  383. // -----------------------------------------------------------------------------
  384. assign i2c_left_prescale = ((I2C_LEFT_CLK_DIVIDER > 4) ? (I2C_LEFT_CLK_DIVIDER - 4) : 0) ;
  385. assign i2c_right_prescale = ((I2C_RIGHT_CLK_DIVIDER > 4) ? (I2C_RIGHT_CLK_DIVIDER - 4) : 0) ;
  386. assign init_value[0] = I2C_LEFT_INIT_VALUE_0 ;
  387. assign init_value[1] = I2C_LEFT_INIT_VALUE_1 ;
  388. assign init_value[2] = I2C_LEFT_INIT_VALUE_2 ;
  389. assign init_value[3] = i2c_left_prescale[9:2] ;
  390. assign init_value[4] = {6'd0,
  391. i2c_left_prescale[11:10]} ;
  392. assign init_value[5] = I2C_RIGHT_INIT_VALUE_5 ;
  393. assign init_value[6] = I2C_RIGHT_INIT_VALUE_6 ;
  394. assign init_value[7] = I2C_RIGHT_INIT_VALUE_7 ;
  395. assign init_value[8] = i2c_right_prescale[9:2] ;
  396. assign init_value[9] = {6'd0,
  397. i2c_right_prescale[11:10]} ;
  398. assign init_value[10] = {3'd0,
  399. SPI_LEFT_INIT_VALUE_10[3:0],
  400. 1'b0} ;
  401. assign init_value[11] = {4'd0,
  402. SPI_LEFT_MASTER_CHIP_SELECTS[3:0]} ;
  403. assign init_value[12] = {1'b1,
  404. SPI_LEFT_WAKEUP_ENABLE[0],
  405. 6'd0} ;
  406. assign init_value[13] = (SPI_LEFT_INIT_VALUE_13 & 8'hA7) ; // 8'hA7 - masks reserved bits
  407. assign init_value[14] = (SPI_LEFT_CLK_DIVIDER - 1) ;
  408. assign init_value[15] = {3'd0,
  409. SPI_RIGHT_INIT_VALUE_15[3:0],
  410. 1'b0} ;
  411. assign init_value[16] = {4'd0,
  412. SPI_RIGHT_MASTER_CHIP_SELECTS[3:0]} ;
  413. assign init_value[17] = {1'b1,
  414. SPI_RIGHT_WAKEUP_ENABLE[0],
  415. 6'd0} ;
  416. assign init_value[18] = (SPI_RIGHT_INIT_VALUE_18 & 8'hA7) ; // 8'hA7 - masks reserved bits
  417. assign init_value[19] = (SPI_RIGHT_CLK_DIVIDER - 1) ;
  418. assign init_value[20] = RSVD ;
  419. assign init_value[21] = RSVD ;
  420. assign init_value[22] = RSVD ;
  421. assign init_addr[20] = RSVD ;
  422. assign init_addr[21] = RSVD ;
  423. assign init_addr[22] = RSVD ;
  424. // SYSTEM BUS multiplexing
  425. assign hard_SBWRi = (IPDONE_i ? sb_wr_i : ssm_SBWRi) ;
  426. assign hard_SBSTBi = (IPDONE_i ? sb_stb_i : ssm_SBSTBi) ;
  427. assign hard_SBADRi = (IPDONE_i ? sb_adr_i : ssm_SBADRi) ;
  428. assign hard_SBDATi = (IPDONE_i ? sb_dat_i : ssm_SBDATi) ;
  429. // {i2c_right, spi_righ, i2c_left, spi_left}
  430. assign hard_ACKs = {hard11_SBACKO,
  431. hard10_SBACKO,
  432. hard01_SBACKO,
  433. hard00_SBACKO} ;
  434. assign SBACKo_i = (|hard_ACKs) ;
  435. // Initialization SSM outputs
  436. assign ssm_SBWRi = 1 ; // All transaction are WRITE
  437. assign ssm_SBSTBi = strobe ;
  438. assign ssm_SBADRi = init_addr[trans_count] ;
  439. assign ssm_SBDATi = init_value[trans_count] ;
  440. assign sb_dat_o = SBDATo_i ;
  441. assign sb_ack_o = (SBACKo_i && IPDONE_i) ;
  442. assign ipdone_o = IPDONE_i ;
  443. // -----------------------------------------------------------------------------
  444. // Generate Assign Statements
  445. // -----------------------------------------------------------------------------
  446. generate
  447. if ((i2c_left_enable == 1))
  448. begin : genblk1
  449. assign init_addr[0] = {I2CBADDRL,
  450. I2CCR1} ;
  451. assign init_addr[1] = {I2CBADDRL,
  452. I2CSADDR} ;
  453. assign init_addr[2] = {I2CBADDRL,
  454. I2CINTCR} ;
  455. assign init_addr[3] = {I2CBADDRL,
  456. I2CBRLSB} ;
  457. assign init_addr[4] = {I2CBADDRL,
  458. I2CBRMSB} ;
  459. end
  460. else
  461. begin : genblk1
  462. assign init_addr[0] = RSVD ;
  463. assign init_addr[1] = RSVD ;
  464. assign init_addr[2] = RSVD ;
  465. assign init_addr[3] = RSVD ;
  466. assign init_addr[4] = RSVD ;
  467. end
  468. if ((i2c_right_enable == 1))
  469. begin : genblk2
  470. assign init_addr[5] = {I2CBADDRR,
  471. I2CCR1} ;
  472. assign init_addr[6] = {I2CBADDRR,
  473. I2CSADDR} ;
  474. assign init_addr[7] = {I2CBADDRR,
  475. I2CINTCR} ;
  476. assign init_addr[8] = {I2CBADDRR,
  477. I2CBRLSB} ;
  478. assign init_addr[9] = {I2CBADDRR,
  479. I2CBRMSB} ;
  480. end
  481. else
  482. begin : genblk2
  483. assign init_addr[5] = RSVD ;
  484. assign init_addr[6] = RSVD ;
  485. assign init_addr[7] = RSVD ;
  486. assign init_addr[8] = RSVD ;
  487. assign init_addr[9] = RSVD ;
  488. end
  489. if ((spi_left_enable == 1))
  490. begin : genblk3
  491. assign init_addr[10] = {SPIBADDRL,
  492. SPIINTCR} ;
  493. assign init_addr[11] = {SPIBADDRL,
  494. SPICSR} ;
  495. assign init_addr[12] = {SPIBADDRL,
  496. SPICR1} ;
  497. assign init_addr[13] = {SPIBADDRL,
  498. SPICR2} ;
  499. assign init_addr[14] = {SPIBADDRL,
  500. SPIBR} ;
  501. end
  502. else
  503. begin : genblk3
  504. assign init_addr[10] = RSVD ;
  505. assign init_addr[11] = RSVD ;
  506. assign init_addr[12] = RSVD ;
  507. assign init_addr[13] = RSVD ;
  508. assign init_addr[14] = RSVD ;
  509. end
  510. if ((spi_right_enable == 1))
  511. begin : genblk4
  512. assign init_addr[15] = {SPIBADDRR,
  513. SPIINTCR} ;
  514. assign init_addr[16] = {SPIBADDRR,
  515. SPICSR} ;
  516. assign init_addr[17] = {SPIBADDRR,
  517. SPICR1} ;
  518. assign init_addr[18] = {SPIBADDRR,
  519. SPICR2} ;
  520. assign init_addr[19] = {SPIBADDRR,
  521. SPIBR} ;
  522. end
  523. else
  524. begin : genblk4
  525. assign init_addr[15] = RSVD ;
  526. assign init_addr[16] = RSVD ;
  527. assign init_addr[17] = RSVD ;
  528. assign init_addr[18] = RSVD ;
  529. assign init_addr[19] = RSVD ;
  530. end
  531. endgenerate
  532. generate
  533. if ((i2c_left_enable == 1))
  534. begin : genblk5
  535. assign i2c2_scl_io = (I2C2_SCLoe ? I2C2_SCLo : 1'bZ) ;
  536. assign i2c2_sda_io = (I2C2_SDAoe ? I2C2_SDAo : 1'bZ) ;
  537. assign I2C2_SCLi = i2c2_scl_io ;
  538. assign I2C2_SDAi = i2c2_sda_io ;
  539. end
  540. if ((i2c_right_enable == 1))
  541. begin : genblk6
  542. assign i2c1_scl_io = (I2C1_SCLoe ? I2C1_SCLo : 1'bZ) ;
  543. assign i2c1_sda_io = (I2C1_SDAoe ? I2C1_SDAo : 1'bZ) ;
  544. assign I2C1_SCLi = i2c1_scl_io ;
  545. assign I2C1_SDAi = i2c1_sda_io ;
  546. end
  547. if ((spi_left_enable == 1))
  548. begin : genblk7
  549. assign spi2_miso_io = (SPI2_SOoe ? SPI2_SO : 1'bZ) ;
  550. assign SPI2_MI = spi2_miso_io ;
  551. assign spi2_mosi_io = (SPI2_MOoe ? SPI2_MO : 1'bZ) ;
  552. assign SPI2_SI = spi2_mosi_io ;
  553. assign spi2_sck_io = (SPI2_SCKoe ? SPI2_SCKo : 1'bZ) ;
  554. assign SPI2_SCKi = spi2_sck_io ;
  555. assign SPI2_SCSNi = spi2_scs_n_i ;
  556. assign spi2_mcs_n_o[3] = (SPI2_MCSNoe[3] ? SPI2_MCSNo[3] : 1'bZ) ;
  557. assign spi2_mcs_n_o[2] = (SPI2_MCSNoe[2] ? SPI2_MCSNo[2] : 1'bZ) ;
  558. assign spi2_mcs_n_o[1] = (SPI2_MCSNoe[1] ? SPI2_MCSNo[1] : 1'bZ) ;
  559. assign spi2_mcs_n_o[0] = (SPI2_MCSNoe[0] ? SPI2_MCSNo[0] : 1'bZ) ;
  560. end
  561. if ((spi_right_enable == 1))
  562. begin : genblk8
  563. assign spi1_miso_io = (SPI1_SOoe ? SPI1_SO : 1'bZ) ;
  564. assign SPI1_MI = spi1_miso_io ;
  565. assign spi1_mosi_io = (SPI1_MOoe ? SPI1_MO : 1'bZ) ;
  566. assign SPI1_SI = spi1_mosi_io ;
  567. assign spi1_sck_io = (SPI1_SCKoe ? SPI1_SCKo : 1'bZ) ;
  568. assign SPI1_SCKi = spi1_sck_io ;
  569. assign SPI1_SCSNi = spi1_scs_n_i ;
  570. assign spi1_mcs_n_o[3] = (SPI1_MCSNoe[3] ? SPI1_MCSNo[3] : 1'bZ) ;
  571. assign spi1_mcs_n_o[2] = (SPI1_MCSNoe[2] ? SPI1_MCSNo[2] : 1'bZ) ;
  572. assign spi1_mcs_n_o[1] = (SPI1_MCSNoe[1] ? SPI1_MCSNo[1] : 1'bZ) ;
  573. assign spi1_mcs_n_o[0] = (SPI1_MCSNoe[0] ? SPI1_MCSNo[0] : 1'bZ) ;
  574. end
  575. endgenerate
  576. // -----------------------------------------------------------------------------
  577. // Combinatorial Blocks
  578. // -----------------------------------------------------------------------------
  579. always
  580. @(*)
  581. begin
  582. wb_we_ix = hard_SBWRi ;
  583. end
  584. always
  585. @(*)
  586. begin
  587. wb_stb_ix = hard_SBSTBi ;
  588. end
  589. always
  590. @(*)
  591. begin
  592. wb_adr_ix = hard_SBADRi ;
  593. end
  594. always
  595. @(*)
  596. begin
  597. wb_dat_ix = hard_SBDATi ;
  598. end
  599. //-----------------------------------------------------------------------------
  600. // DATo mux
  601. //-----------------------------------------------------------------------------
  602. always
  603. @(*)
  604. begin
  605. case (hard_ACKs)
  606. 4'b1000 :
  607. SBDATo_i = hard11_SBDATo ;
  608. 4'b0100 :
  609. SBDATo_i = hard10_SBDATo ;
  610. 4'b0010 :
  611. SBDATo_i = hard01_SBDATo ;
  612. 4'b0001 :
  613. SBDATo_i = hard00_SBDATo ;
  614. default :
  615. SBDATo_i = 8'b0 ;
  616. endcase
  617. end
  618. //-----------------------------------------------------------------------------
  619. // Initialization SSM control: Start, Run, Done
  620. //-----------------------------------------------------------------------------
  621. always
  622. @(posedge sb_clk_i or
  623. posedge rst_i)
  624. begin
  625. if (rst_i)
  626. begin
  627. load_d1 <= 0 ;
  628. load_d2 <= 0 ;
  629. start <= 0 ;
  630. pup <= 1 ;
  631. run <= 0 ;
  632. trans_count <= 0 ;
  633. IPDONE_i <= 0 ;
  634. end
  635. else
  636. begin
  637. load_d1 <= (ipload_i || pup) ;
  638. load_d2 <= load_d1 ;
  639. start <= (load_d1 && (!load_d2)) ;// rising-edge detection
  640. if (start) // clear power-up launch flag
  641. pup <= 0 ;
  642. if (start)
  643. run <= 1 ;
  644. else
  645. // start init sequence
  646. if (IPDONE_i) // clear when init complete
  647. run <= 0 ;
  648. // reset control upon Start
  649. if (start)
  650. begin
  651. trans_count <= start_count ;
  652. IPDONE_i <= 0 ;
  653. end
  654. else
  655. // DONE
  656. if ((init_addr[trans_count] == 8'hFF))
  657. begin
  658. IPDONE_i <= 1 ;
  659. end
  660. else
  661. // increment if not DONE
  662. if (SBACKo_i)
  663. begin
  664. trans_count <= next_count ;
  665. end
  666. end
  667. end
  668. always
  669. @(*)
  670. begin
  671. start_count = (i2c_left_enable ? 6'd0 : (i2c_right_enable ? 6'd5 : (spi_left_enable ? 6'd10 : (spi_right_enable ? 6'd15 : 6'd20)))) ;
  672. next_count = ((((trans_count + 1) < 6'd20) && (init_addr[(trans_count + 1)] != 8'hFF)) ? (trans_count + 1) : ((((trans_count + 6) < 6'd20) && (init_addr[(trans_count + 6)] != 8'hFF)) ? (trans_count + 6) : ((((trans_count + 11) < 6'd20) && (init_addr[(trans_count + 11)] != 8'hFF)) ? (trans_count + 11) : 6'd20))) ;
  673. end//--always @*--
  674. //-----------------------------------------------------------------------------
  675. // System Bus transaction control
  676. // Assert stb until EFB acknowledges with sb_ack_o
  677. //-----------------------------------------------------------------------------
  678. always
  679. @(posedge sb_clk_i or
  680. posedge rst_i)
  681. begin
  682. if (rst_i)
  683. begin
  684. sb_idle <= 1 ;
  685. strobe <= 0 ;
  686. end
  687. else
  688. begin
  689. // Assert stb signals to start SB transaction
  690. if (sb_idle)
  691. begin
  692. if (run)
  693. begin
  694. // delay 1 ns to avoid simulation/hardware mismatch
  695. strobe <= #(1) 1 ;
  696. sb_idle <= 0 ;
  697. end
  698. end
  699. else
  700. // Monitor sb_ack_o for end of transaction
  701. begin
  702. if ((SBACKo_i | (!run)))
  703. begin
  704. strobe <= 0 ;
  705. sb_idle <= 1 ;
  706. end
  707. end
  708. end
  709. end
  710. // -----------------------------------------------------------------------------
  711. // Submodule Instantiations
  712. // -----------------------------------------------------------------------------
  713. generate
  714. if ((i2c_left_enable == 1))
  715. begin : genblk9
  716. I2C_B #(.I2C_SLAVE_INIT_ADDR(I2C_LEFT_SLAVE_INIT_ADDR),
  717. .BUS_ADDR74("0b0001"),
  718. .I2C_CLK_DIVIDER(I2C_LEFT_CLK_PRESCALE),
  719. .FREQUENCY_PIN_SBCLKI(FREQUENCY_PIN_SBCLKI),
  720. .SDA_INPUT_DELAYED(I2C_LEFT_SDA_INPUT_DELAYED),
  721. .SDA_OUTPUT_DELAYED(I2C_LEFT_SDA_OUTPUT_DELAYED)) u_I2C_B_INST_LT (.SBCLKI(sb_clk_i),
  722. .SBRWI(wb_we_ix),
  723. .SBSTBI(wb_stb_ix),
  724. .SBADRI7(wb_adr_ix[7]),
  725. .SBADRI6(wb_adr_ix[6]),
  726. .SBADRI5(wb_adr_ix[5]),
  727. .SBADRI4(wb_adr_ix[4]),
  728. .SBADRI3(wb_adr_ix[3]),
  729. .SBADRI2(wb_adr_ix[2]),
  730. .SBADRI1(wb_adr_ix[1]),
  731. .SBADRI0(wb_adr_ix[0]),
  732. .SBDATI7(wb_dat_ix[7]),
  733. .SBDATI6(wb_dat_ix[6]),
  734. .SBDATI5(wb_dat_ix[5]),
  735. .SBDATI4(wb_dat_ix[4]),
  736. .SBDATI3(wb_dat_ix[3]),
  737. .SBDATI2(wb_dat_ix[2]),
  738. .SBDATI1(wb_dat_ix[1]),
  739. .SBDATI0(wb_dat_ix[0]),
  740. .SCLI(I2C2_SCLi),
  741. .SDAI(I2C2_SDAi),
  742. .SBDATO7(hard01_SBDATo[7]),
  743. .SBDATO6(hard01_SBDATo[6]),
  744. .SBDATO5(hard01_SBDATo[5]),
  745. .SBDATO4(hard01_SBDATo[4]),
  746. .SBDATO3(hard01_SBDATo[3]),
  747. .SBDATO2(hard01_SBDATo[2]),
  748. .SBDATO1(hard01_SBDATo[1]),
  749. .SBDATO0(hard01_SBDATo[0]),
  750. .SBACKO(hard01_SBACKO),
  751. .I2CIRQ(i2c_pirq_o[0]),
  752. .I2CWKUP(i2c_pwkup_o[0]),
  753. .SCLO(I2C2_SCLo),
  754. .SCLOE(I2C2_SCLoe),
  755. .SDAO(I2C2_SDAo),
  756. .SDAOE(I2C2_SDAoe)) ;
  757. end
  758. else
  759. begin : genblk9
  760. assign hard01_SBDATo[7] = 1'b0 ;
  761. assign hard01_SBDATo[6] = 1'b0 ;
  762. assign hard01_SBDATo[5] = 1'b0 ;
  763. assign hard01_SBDATo[4] = 1'b0 ;
  764. assign hard01_SBDATo[3] = 1'b0 ;
  765. assign hard01_SBDATo[2] = 1'b0 ;
  766. assign hard01_SBDATo[1] = 1'b0 ;
  767. assign hard01_SBDATo[0] = 1'b0 ;
  768. assign hard01_SBACKO = 1'b0 ;
  769. assign i2c_pirq_o[0] = 1'b0 ;
  770. assign i2c_pwkup_o[0] = 1'b0 ;
  771. end
  772. if ((i2c_right_enable == 1))
  773. begin : genblk10
  774. I2C_B #(.I2C_SLAVE_INIT_ADDR(I2C_RIGHT_SLAVE_INIT_ADDR),
  775. .BUS_ADDR74("0b0011"),
  776. .I2C_CLK_DIVIDER(I2C_RIGHT_CLK_PRESCALE),
  777. .FREQUENCY_PIN_SBCLKI(FREQUENCY_PIN_SBCLKI),
  778. .SDA_INPUT_DELAYED(I2C_RIGHT_SDA_INPUT_DELAYED),
  779. .SDA_OUTPUT_DELAYED(I2C_RIGHT_SDA_OUTPUT_DELAYED)) u_I2C_B_INST_RT (.SBCLKI(sb_clk_i),
  780. .SBRWI(wb_we_ix),
  781. .SBSTBI(wb_stb_ix),
  782. .SBADRI7(wb_adr_ix[7]),
  783. .SBADRI6(wb_adr_ix[6]),
  784. .SBADRI5(wb_adr_ix[5]),
  785. .SBADRI4(wb_adr_ix[4]),
  786. .SBADRI3(wb_adr_ix[3]),
  787. .SBADRI2(wb_adr_ix[2]),
  788. .SBADRI1(wb_adr_ix[1]),
  789. .SBADRI0(wb_adr_ix[0]),
  790. .SBDATI7(wb_dat_ix[7]),
  791. .SBDATI6(wb_dat_ix[6]),
  792. .SBDATI5(wb_dat_ix[5]),
  793. .SBDATI4(wb_dat_ix[4]),
  794. .SBDATI3(wb_dat_ix[3]),
  795. .SBDATI2(wb_dat_ix[2]),
  796. .SBDATI1(wb_dat_ix[1]),
  797. .SBDATI0(wb_dat_ix[0]),
  798. .SCLI(I2C1_SCLi),
  799. .SDAI(I2C1_SDAi),
  800. .SBDATO7(hard11_SBDATo[7]),
  801. .SBDATO6(hard11_SBDATo[6]),
  802. .SBDATO5(hard11_SBDATo[5]),
  803. .SBDATO4(hard11_SBDATo[4]),
  804. .SBDATO3(hard11_SBDATo[3]),
  805. .SBDATO2(hard11_SBDATo[2]),
  806. .SBDATO1(hard11_SBDATo[1]),
  807. .SBDATO0(hard11_SBDATo[0]),
  808. .SBACKO(hard11_SBACKO),
  809. .I2CIRQ(i2c_pirq_o[1]),
  810. .I2CWKUP(i2c_pwkup_o[1]),
  811. .SCLO(I2C1_SCLo),
  812. .SCLOE(I2C1_SCLoe),
  813. .SDAO(I2C1_SDAo),
  814. .SDAOE(I2C1_SDAoe)) ;
  815. end
  816. else
  817. begin : genblk10
  818. assign hard11_SBDATo[7] = 1'b0 ;
  819. assign hard11_SBDATo[6] = 1'b0 ;
  820. assign hard11_SBDATo[5] = 1'b0 ;
  821. assign hard11_SBDATo[4] = 1'b0 ;
  822. assign hard11_SBDATo[3] = 1'b0 ;
  823. assign hard11_SBDATo[2] = 1'b0 ;
  824. assign hard11_SBDATo[1] = 1'b0 ;
  825. assign hard11_SBDATo[0] = 1'b0 ;
  826. assign hard11_SBACKO = 1'b0 ;
  827. assign i2c_pirq_o[1] = 1'b0 ;
  828. assign i2c_pwkup_o[1] = 1'b0 ;
  829. end
  830. if ((spi_left_enable == 1))
  831. begin : genblk11
  832. SPI_B #(.FREQUENCY_PIN_SBCLKI(FREQUENCY_PIN_SBCLKI),
  833. .SPI_CLK_DIVIDER(SPI_LEFT_CLK_PRESCALE),
  834. .BUS_ADDR74("0b0000")) u_SPI_B_INST_LT (.SBCLKI(sb_clk_i),
  835. .SBRWI(wb_we_ix),
  836. .SBSTBI(wb_stb_ix),
  837. .SBADRI7(wb_adr_ix[7]),
  838. .SBADRI6(wb_adr_ix[6]),
  839. .SBADRI5(wb_adr_ix[5]),
  840. .SBADRI4(wb_adr_ix[4]),
  841. .SBADRI3(wb_adr_ix[3]),
  842. .SBADRI2(wb_adr_ix[2]),
  843. .SBADRI1(wb_adr_ix[1]),
  844. .SBADRI0(wb_adr_ix[0]),
  845. .SBDATI7(wb_dat_ix[7]),
  846. .SBDATI6(wb_dat_ix[6]),
  847. .SBDATI5(wb_dat_ix[5]),
  848. .SBDATI4(wb_dat_ix[4]),
  849. .SBDATI3(wb_dat_ix[3]),
  850. .SBDATI2(wb_dat_ix[2]),
  851. .SBDATI1(wb_dat_ix[1]),
  852. .SBDATI0(wb_dat_ix[0]),
  853. .MI(SPI2_MI),
  854. .SI(SPI2_SI),
  855. .SCKI(SPI2_SCKi),
  856. .SCSNI(SPI2_SCSNi),
  857. .SBDATO7(hard00_SBDATo[7]),
  858. .SBDATO6(hard00_SBDATo[6]),
  859. .SBDATO5(hard00_SBDATo[5]),
  860. .SBDATO4(hard00_SBDATo[4]),
  861. .SBDATO3(hard00_SBDATo[3]),
  862. .SBDATO2(hard00_SBDATo[2]),
  863. .SBDATO1(hard00_SBDATo[1]),
  864. .SBDATO0(hard00_SBDATo[0]),
  865. .SBACKO(hard00_SBACKO),
  866. .SPIIRQ(spi_pirq_o[0]),
  867. .SPIWKUP(spi_pwkup_o[0]),
  868. .SO(SPI2_SO),
  869. .SOE(SPI2_SOoe),
  870. .MO(SPI2_MO),
  871. .MOE(SPI2_MOoe),
  872. .SCKO(SPI2_SCKo),
  873. .SCKOE(SPI2_SCKoe),
  874. .MCSNO3(SPI2_MCSNo[3]),
  875. .MCSNO2(SPI2_MCSNo[2]),
  876. .MCSNO1(SPI2_MCSNo[1]),
  877. .MCSNO0(SPI2_MCSNo[0]),
  878. .MCSNOE3(SPI2_MCSNoe[3]),
  879. .MCSNOE2(SPI2_MCSNoe[2]),
  880. .MCSNOE1(SPI2_MCSNoe[1]),
  881. .MCSNOE0(SPI2_MCSNoe[0])) ;
  882. end
  883. else
  884. begin : genblk11
  885. assign hard00_SBDATo[7] = 1'b0 ;
  886. assign hard00_SBDATo[6] = 1'b0 ;
  887. assign hard00_SBDATo[5] = 1'b0 ;
  888. assign hard00_SBDATo[4] = 1'b0 ;
  889. assign hard00_SBDATo[3] = 1'b0 ;
  890. assign hard00_SBDATo[2] = 1'b0 ;
  891. assign hard00_SBDATo[1] = 1'b0 ;
  892. assign hard00_SBDATo[0] = 1'b0 ;
  893. assign hard00_SBACKO = 1'b0 ;
  894. assign spi_pirq_o[0] = 1'b0 ;
  895. assign spi_pwkup_o[0] = 1'b0 ;
  896. end
  897. if ((spi_right_enable == 1))
  898. begin : genblk12
  899. SPI_B #(.FREQUENCY_PIN_SBCLKI(FREQUENCY_PIN_SBCLKI),
  900. .SPI_CLK_DIVIDER(SPI_RIGHT_CLK_PRESCALE),
  901. .BUS_ADDR74("0b0010")) u_SPI_B_INST_RT (.SBCLKI(sb_clk_i),
  902. .SBRWI(wb_we_ix),
  903. .SBSTBI(wb_stb_ix),
  904. .SBADRI7(wb_adr_ix[7]),
  905. .SBADRI6(wb_adr_ix[6]),
  906. .SBADRI5(wb_adr_ix[5]),
  907. .SBADRI4(wb_adr_ix[4]),
  908. .SBADRI3(wb_adr_ix[3]),
  909. .SBADRI2(wb_adr_ix[2]),
  910. .SBADRI1(wb_adr_ix[1]),
  911. .SBADRI0(wb_adr_ix[0]),
  912. .SBDATI7(wb_dat_ix[7]),
  913. .SBDATI6(wb_dat_ix[6]),
  914. .SBDATI5(wb_dat_ix[5]),
  915. .SBDATI4(wb_dat_ix[4]),
  916. .SBDATI3(wb_dat_ix[3]),
  917. .SBDATI2(wb_dat_ix[2]),
  918. .SBDATI1(wb_dat_ix[1]),
  919. .SBDATI0(wb_dat_ix[0]),
  920. .MI(SPI1_MI),
  921. .SI(SPI1_SI),
  922. .SCKI(SPI1_SCKi),
  923. .SCSNI(SPI1_SCSNi),
  924. .SBDATO7(hard10_SBDATo[7]),
  925. .SBDATO6(hard10_SBDATo[6]),
  926. .SBDATO5(hard10_SBDATo[5]),
  927. .SBDATO4(hard10_SBDATo[4]),
  928. .SBDATO3(hard10_SBDATo[3]),
  929. .SBDATO2(hard10_SBDATo[2]),
  930. .SBDATO1(hard10_SBDATo[1]),
  931. .SBDATO0(hard10_SBDATo[0]),
  932. .SBACKO(hard10_SBACKO),
  933. .SPIIRQ(spi_pirq_o[1]),
  934. .SPIWKUP(spi_pwkup_o[1]),
  935. .SO(SPI1_SO),
  936. .SOE(SPI1_SOoe),
  937. .MO(SPI1_MO),
  938. .MOE(SPI1_MOoe),
  939. .SCKO(SPI1_SCKo),
  940. .SCKOE(SPI1_SCKoe),
  941. .MCSNO3(SPI1_MCSNo[3]),
  942. .MCSNO2(SPI1_MCSNo[2]),
  943. .MCSNO1(SPI1_MCSNo[1]),
  944. .MCSNO0(SPI1_MCSNo[0]),
  945. .MCSNOE3(SPI1_MCSNoe[3]),
  946. .MCSNOE2(SPI1_MCSNoe[2]),
  947. .MCSNOE1(SPI1_MCSNoe[1]),
  948. .MCSNOE0(SPI1_MCSNoe[0])) ;
  949. end
  950. else
  951. begin : genblk12
  952. assign hard10_SBDATo[7] = 1'b0 ;
  953. assign hard10_SBDATo[6] = 1'b0 ;
  954. assign hard10_SBDATo[5] = 1'b0 ;
  955. assign hard10_SBDATo[4] = 1'b0 ;
  956. assign hard10_SBDATo[3] = 1'b0 ;
  957. assign hard10_SBDATo[2] = 1'b0 ;
  958. assign hard10_SBDATo[1] = 1'b0 ;
  959. assign hard10_SBDATo[0] = 1'b0 ;
  960. assign hard10_SBACKO = 1'b0 ;
  961. assign spi_pirq_o[1] = 1'b0 ;
  962. assign spi_pwkup_o[1] = 1'b0 ;
  963. end
  964. endgenerate
  965. endmodule