primitives_xilinx.v
Upload User: lifezer
Upload Date: 2013-03-20
Package Size: 25k
Code Size: 17k
Development Platform:

MultiPlatform

  1. /////////////////////////////////////////////////////////////////////
  2. ////                                                             ////
  3. ////  Mini-RISC-1                                                ////
  4. ////  Prescaler and Wachdog Counter                              ////
  5. ////                                                             ////
  6. ////                                                             ////
  7. ////  Author: Rudolf Usselmann                                   ////
  8. ////          rudi@asics.ws                                      ////
  9. ////                                                             ////
  10. ////                                                             ////
  11. ////  D/L from: http://www.opencores.org/cores/minirisc/         ////
  12. ////                                                             ////
  13. /////////////////////////////////////////////////////////////////////
  14. ////                                                             ////
  15. //// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
  16. ////                         www.asics.ws                        ////
  17. ////                         rudi@asics.ws                       ////
  18. ////                                                             ////
  19. //// This source file may be used and distributed without        ////
  20. //// restriction provided that this copyright statement is not   ////
  21. //// removed from the file and that any derivative work contains ////
  22. //// the original copyright notice and the associated disclaimer.////
  23. ////                                                             ////
  24. ////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
  25. //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
  26. //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
  27. //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
  28. //// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
  29. //// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
  30. //// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
  31. //// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
  32. //// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
  33. //// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
  34. //// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
  35. //// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
  36. //// POSSIBILITY OF SUCH DAMAGE.                                 ////
  37. ////                                                             ////
  38. /////////////////////////////////////////////////////////////////////
  39. //  CVS Log
  40. //
  41. //  $Id: primitives_xilinx.v,v 1.3 2002/10/01 12:44:24 rudi Exp $
  42. //
  43. //  $Date: 2002/10/01 12:44:24 $
  44. //  $Revision: 1.3 $
  45. //  $Author: rudi $
  46. //  $Locker:  $
  47. //  $State: Exp $
  48. //
  49. // Change History:
  50. //               $Log: primitives_xilinx.v,v $
  51. //               Revision 1.3  2002/10/01 12:44:24  rudi
  52. //               Tweaked code a bit - trying to get it run faster ...
  53. //
  54. //               Revision 1.2  2002/09/27 15:35:40  rudi
  55. //               Minor update to newer devices ...
  56. //
  57. //
  58. //
  59. //
  60. //
  61. //
  62. //
  63. //
  64. //
  65. //
  66. //
  67. `timescale 1ns / 10ps
  68. // LIB_TAG
  69. // synopsys translate_off
  70. `include "XilinxCoreLib/C_ADDSUB_V1_0.v"
  71. `include "XilinxCoreLib/C_MUX_BUS_V1_0.v"
  72. `include "XilinxCoreLib/C_COMPARE_V1_0.v"
  73. `include "XilinxCoreLib/C_MUX_BIT_V1_0.v"
  74. `include "XilinxCoreLib/C_MEM_DP_BLOCK_V1_0.v"
  75. `include "XilinxCoreLib/C_REG_FD_V1_0.v"
  76. // synopsys translate_on
  77. // LIB_TAG_END
  78. // Mux 4:1 8 bits wide
  79. module mux4_8(sel, in0, in1, in2, in3, out);
  80. input [1:0] sel;
  81. input [7:0] in0, in1, in2, in3;
  82. output [7:0] out;
  83. // INST_TAG
  84. xilinx_mux4_8 u0 (
  85. .MA0(in0[0]),
  86. .MA1(in0[1]),
  87. .MA2(in0[2]),
  88. .MA3(in0[3]),
  89. .MA4(in0[4]),
  90. .MA5(in0[5]),
  91. .MA6(in0[6]),
  92. .MA7(in0[7]),
  93. .MB0(in1[0]),
  94. .MB1(in1[1]),
  95. .MB2(in1[2]),
  96. .MB3(in1[3]),
  97. .MB4(in1[4]),
  98. .MB5(in1[5]),
  99. .MB6(in1[6]),
  100. .MB7(in1[7]),
  101. .MC0(in2[0]),
  102. .MC1(in2[1]),
  103. .MC2(in2[2]),
  104. .MC3(in2[3]),
  105. .MC4(in2[4]),
  106. .MC5(in2[5]),
  107. .MC6(in2[6]),
  108. .MC7(in2[7]),
  109. .MD0(in3[0]),
  110. .MD1(in3[1]),
  111. .MD2(in3[2]),
  112. .MD3(in3[3]),
  113. .MD4(in3[4]),
  114. .MD5(in3[5]),
  115. .MD6(in3[6]),
  116. .MD7(in3[7]),
  117. .S0(sel[0]),
  118. .S1(sel[1]),
  119. .O0(out[0]),
  120. .O1(out[1]),
  121. .O2(out[2]),
  122. .O3(out[3]),
  123. .O4(out[4]),
  124. .O5(out[5]),
  125. .O6(out[6]),
  126. .O7(out[7]) );
  127. // INST_TAG_END
  128. endmodule
  129. /*
  130. // MOD_TAG
  131. module xilinx_mux4_8 (MA,MB,MC,MD,S,O); // synthesis black_box
  132. input [7:0] MA;
  133. input [7:0] MB;
  134. input [7:0] MC;
  135. input [7:0] MD;
  136. input [1:0] S;
  137. output [7:0] O;
  138. // synopsys translate_off
  139. // synthesis translate_off
  140. C_MUX_BUS_V1_0 #(
  141. "00000000",
  142. 1,
  143. 0,
  144. 0,
  145. 0,
  146. 0,
  147. 0,
  148. 1,
  149. 0,
  150. 0,
  151. 0,
  152. 0,
  153. 4,
  154. 0,
  155. 2,
  156. "00000000",
  157. 0,
  158. 1,
  159. 8)
  160. inst (
  161. .MA(MA),
  162. .MB(MB),
  163. .MC(MC),
  164. .MD(MD),
  165. .S(S),
  166. .O(O));
  167. // synthesis translate_on
  168. // synopsys translate_on
  169. endmodule
  170. // MOD_TAG_END
  171. */
  172. // 8 bit comparator
  173. module cmp8_eq(a,b,eq);
  174. input [7:0] a,b;
  175. output eq;
  176. // INST_TAG
  177. xilinx_cmp8_eq u0 (
  178. .A0(a[0]),
  179. .A1(a[1]),
  180. .A2(a[2]),
  181. .A3(a[3]),
  182. .A4(a[4]),
  183. .A5(a[5]),
  184. .A6(a[6]),
  185. .A7(a[7]),
  186. .B0(b[0]),
  187. .B1(b[1]),
  188. .B2(b[2]),
  189. .B3(b[3]),
  190. .B4(b[4]),
  191. .B5(b[5]),
  192. .B6(b[6]),
  193. .B7(b[7]),
  194. .A_EQ_B(eq) );
  195. // INST_TAG_END
  196. endmodule
  197. /*
  198. // MOD_TAG
  199. module xilinx_cmp8_eq (A,B,A_EQ_B); // synthesis black_box
  200. input [7 : 0] A;
  201. input [7 : 0] B;
  202. output A_EQ_B;
  203. // synopsys translate_off
  204. // synthesis translate_off
  205. C_COMPARE_V1_0 #(
  206. "0",
  207. 0,
  208. "0",
  209. 1,
  210. 1,
  211. 0,
  212. 0,
  213. 1,
  214. 0,
  215. 0,
  216. 0,
  217. 0,
  218. 0,
  219. 0,
  220. 0,
  221. 0,
  222. 0,
  223. 0,
  224. 0,
  225. 0,
  226. 0,
  227. 0,
  228. 0,
  229. 0,
  230. 1,
  231. 8)
  232. inst (
  233. .A(A),
  234. .B(B),
  235. .A_EQ_B(A_EQ_B));
  236. // synthesis translate_on
  237. // synopsys translate_on
  238. endmodule
  239. // MOD_TAG_END
  240. */
  241. // MUX 2:1 7 bits wide
  242. module mux2_7(sel, in0, in1, out);
  243. input sel;
  244. input [6:0] in0, in1;
  245. output [6:0] out;
  246. // INST_TAG
  247. xilinx_mux2_7 u0 (
  248. .MA0(in0[0]),
  249. .MA1(in0[1]),
  250. .MA2(in0[2]),
  251. .MA3(in0[3]),
  252. .MA4(in0[4]),
  253. .MA5(in0[5]),
  254. .MA6(in0[6]),
  255. .MB0(in1[0]),
  256. .MB1(in1[1]),
  257. .MB2(in1[2]),
  258. .MB3(in1[3]),
  259. .MB4(in1[4]),
  260. .MB5(in1[5]),
  261. .MB6(in1[6]),
  262. .S0(sel),
  263. .O0(out[0]),
  264. .O1(out[1]),
  265. .O2(out[2]),
  266. .O3(out[3]),
  267. .O4(out[4]),
  268. .O5(out[5]),
  269. .O6(out[6]) );
  270. // INST_TAG_END
  271. endmodule
  272. /*
  273. // MOD_TAG
  274. module xilinx_mux2_7 (MA,MB,S,O); // synthesis black_box
  275. input [6 : 0] MA;
  276. input [6 : 0] MB;
  277. input [0 : 0] S;
  278. output [6 : 0] O;
  279. // synopsys translate_off
  280. // synthesis translate_off
  281. C_MUX_BUS_V1_0 #(
  282. "0000000",
  283. 1,
  284. 0,
  285. 0,
  286. 0,
  287. 0,
  288. 0,
  289. 1,
  290. 0,
  291. 0,
  292. 0,
  293. 0,
  294. 2,
  295. 0,
  296. 1,
  297. "0000000",
  298. 0,
  299. 1,
  300. 7)
  301. inst (
  302. .MA(MA),
  303. .MB(MB),
  304. .S(S),
  305. .O(O));
  306. // synthesis translate_on
  307. // synopsys translate_on
  308. endmodule
  309. // MOD_TAG_END
  310. */
  311. // Mux 8:1 1 bit wide
  312. module mux8_1( sel, in, out);
  313. input [2:0] sel;
  314. input [7:0] in;
  315. output out;
  316. // INST_TAG
  317. xilinx_mux8_1 u0 (
  318. .M0(in[0]),
  319. .M1(in[1]),
  320. .M2(in[2]),
  321. .M3(in[3]),
  322. .M4(in[4]),
  323. .M5(in[5]),
  324. .M6(in[6]),
  325. .M7(in[7]),
  326. .S0(sel[0]),
  327. .S1(sel[1]),
  328. .S2(sel[2]),
  329. .O(out));
  330. // INST_TAG_END
  331. endmodule
  332. /*
  333. // MOD_TAG
  334. module xilinx_mux8_1 (M,S,O); // synthesis black_box
  335. input [7 : 0] M;
  336. input [2 : 0] S;
  337. output O;
  338. // synopsys translate_off
  339. // synthesis translate_off
  340. C_MUX_BIT_V1_0 #(
  341. "0",
  342. 1,
  343. 0,
  344. 0,
  345. 0,
  346. 0,
  347. 1,
  348. 0,
  349. 0,
  350. 0,
  351. 0,
  352. 8,
  353. 3,
  354. "0",
  355. 0,
  356. 1)
  357. inst (
  358. .M(M),
  359. .S(S),
  360. .O(O));
  361. // synthesis translate_on
  362. // synopsys translate_on
  363. endmodule
  364. // MOD_TAG_END
  365. */
  366. // Mux 2:1 8 bits wide
  367. module mux2_8(sel, in0, in1, out);
  368. input sel;
  369. input [7:0] in0, in1;
  370. output [7:0] out;
  371. // INST_TAG
  372. xilinx_mux2_8 u0(
  373. .MA0(in0[0]),
  374. .MA1(in0[1]),
  375. .MA2(in0[2]),
  376. .MA3(in0[3]),
  377. .MA4(in0[4]),
  378. .MA5(in0[5]),
  379. .MA6(in0[6]),
  380. .MA7(in0[7]),
  381. .MB0(in1[0]),
  382. .MB1(in1[1]),
  383. .MB2(in1[2]),
  384. .MB3(in1[3]),
  385. .MB4(in1[4]),
  386. .MB5(in1[5]),
  387. .MB6(in1[6]),
  388. .MB7(in1[7]),
  389. .S0(sel),
  390. .O0(out[0]),
  391. .O1(out[1]),
  392. .O2(out[2]),
  393. .O3(out[3]),
  394. .O4(out[4]),
  395. .O5(out[5]),
  396. .O6(out[6]),
  397. .O7(out[7]) );
  398. // INST_TAG_END
  399. endmodule
  400. /*
  401. // MOD_TAG
  402. module xilinx_mux2_8 (MA, MB, S, O); // synthesis black_box
  403. input [7 : 0] MA;
  404. input [7 : 0] MB;
  405. input [0 : 0] S;
  406. output [7 : 0] O;
  407. // synopsys translate_off
  408. // synthesis translate_off
  409. C_MUX_BUS_V1_0 #(
  410. "00000000",
  411. 1,
  412. 0,
  413. 0,
  414. 0,
  415. 0,
  416. 0,
  417. 1,
  418. 0,
  419. 0,
  420. 0,
  421. 0,
  422. 2,
  423. 0,
  424. 1,
  425. "00000000",
  426. 0,
  427. 1,
  428. 8)
  429. inst (
  430. .MA(MA),
  431. .MB(MB),
  432. .S(S),
  433. .O(O));
  434. // synthesis translate_on
  435. // synopsys translate_on
  436. endmodule
  437. // MOD_TAG_END
  438. */
  439. // Mux 8:1 8 bits wide
  440. module mux8_8(sel, in0, in1, in2, in3, in4, in5, in6, in7, out);
  441. input [2:0] sel;
  442. input [7:0] in0, in1, in2, in3, in4, in5, in6, in7;
  443. output [7:0] out;
  444. // INST_TAG
  445. xilinx_mux8_8 u0 (
  446. .MA0(in0[0]),
  447. .MA1(in0[1]),
  448. .MA2(in0[2]),
  449. .MA3(in0[3]),
  450. .MA4(in0[4]),
  451. .MA5(in0[5]),
  452. .MA6(in0[6]),
  453. .MA7(in0[7]),
  454. .MB0(in1[0]),
  455. .MB1(in1[1]),
  456. .MB2(in1[2]),
  457. .MB3(in1[3]),
  458. .MB4(in1[4]),
  459. .MB5(in1[5]),
  460. .MB6(in1[6]),
  461. .MB7(in1[7]),
  462. .MC0(in2[0]),
  463. .MC1(in2[1]),
  464. .MC2(in2[2]),
  465. .MC3(in2[3]),
  466. .MC4(in2[4]),
  467. .MC5(in2[5]),
  468. .MC6(in2[6]),
  469. .MC7(in2[7]),
  470. .MD0(in3[0]),
  471. .MD1(in3[1]),
  472. .MD2(in3[2]),
  473. .MD3(in3[3]),
  474. .MD4(in3[4]),
  475. .MD5(in3[5]),
  476. .MD6(in3[6]),
  477. .MD7(in3[7]),
  478. .ME0(in4[0]),
  479. .ME1(in4[1]),
  480. .ME2(in4[2]),
  481. .ME3(in4[3]),
  482. .ME4(in4[4]),
  483. .ME5(in4[5]),
  484. .ME6(in4[6]),
  485. .ME7(in4[7]),
  486. .MF0(in5[0]),
  487. .MF1(in5[1]),
  488. .MF2(in5[2]),
  489. .MF3(in5[3]),
  490. .MF4(in5[4]),
  491. .MF5(in5[5]),
  492. .MF6(in5[6]),
  493. .MF7(in5[7]),
  494. .MG0(in6[0]),
  495. .MG1(in6[1]),
  496. .MG2(in6[2]),
  497. .MG3(in6[3]),
  498. .MG4(in6[4]),
  499. .MG5(in6[5]),
  500. .MG6(in6[6]),
  501. .MG7(in6[7]),
  502. .MH0(in7[0]),
  503. .MH1(in7[1]),
  504. .MH2(in7[2]),
  505. .MH3(in7[3]),
  506. .MH4(in7[4]),
  507. .MH5(in7[5]),
  508. .MH6(in7[6]),
  509. .MH7(in7[7]),
  510. .S0(sel[0]),
  511. .S1(sel[1]),
  512. .S2(sel[2]),
  513. .O0(out[0]),
  514. .O1(out[1]),
  515. .O2(out[2]),
  516. .O3(out[3]),
  517. .O4(out[4]),
  518. .O5(out[5]),
  519. .O6(out[6]),
  520. .O7(out[7]) );
  521. // INST_TAG_END
  522. endmodule
  523. /*
  524. // MOD_TAG
  525. module xilinx_mux8_8 (MA,MB,MC,MD,ME,MF,MG,MH,S,O); // synthesis black_box
  526. input [7 : 0] MA;
  527. input [7 : 0] MB;
  528. input [7 : 0] MC;
  529. input [7 : 0] MD;
  530. input [7 : 0] ME;
  531. input [7 : 0] MF;
  532. input [7 : 0] MG;
  533. input [7 : 0] MH;
  534. input [2 : 0] S;
  535. output [7 : 0] O;
  536. // synopsys translate_off
  537. // synthesis translate_off
  538. C_MUX_BUS_V1_0 #(
  539. "00000000",
  540. 1,
  541. 0,
  542. 0,
  543. 0,
  544. 0,
  545. 0,
  546. 1,
  547. 0,
  548. 0,
  549. 0,
  550. 0,
  551. 8,
  552. 0,
  553. 3,
  554. "00000000",
  555. 0,
  556. 1,
  557. 8)
  558. inst (
  559. .MA(MA),
  560. .MB(MB),
  561. .MC(MC),
  562. .MD(MD),
  563. .ME(ME),
  564. .MF(MF),
  565. .MG(MG),
  566. .MH(MH),
  567. .S(S),
  568. .O(O));
  569. // synthesis translate_on
  570. // synopsys translate_on
  571. endmodule
  572. // MOD_TAG_END
  573. */
  574. // Mux 2:1 11 bits wide
  575. module mux2_11(sel, in0, in1, out);
  576. input sel;
  577. input [10:0] in0, in1;
  578. output [10:0] out;
  579. // INST_TAG
  580. xilinx_mux2_11 u0 (
  581. .MA0(in0[0]),
  582. .MA1(in0[1]),
  583. .MA2(in0[2]),
  584. .MA3(in0[3]),
  585. .MA4(in0[4]),
  586. .MA5(in0[5]),
  587. .MA6(in0[6]),
  588. .MA7(in0[7]),
  589. .MA8(in0[8]),
  590. .MA9(in0[9]),
  591. .MA10(in0[10]),
  592. .MB0(in1[0]),
  593. .MB1(in1[1]),
  594. .MB2(in1[2]),
  595. .MB3(in1[3]),
  596. .MB4(in1[4]),
  597. .MB5(in1[5]),
  598. .MB6(in1[6]),
  599. .MB7(in1[7]),
  600. .MB8(in1[8]),
  601. .MB9(in1[9]),
  602. .MB10(in1[10]),
  603. .S0(sel),
  604. .O0(out[0]),
  605. .O1(out[1]),
  606. .O2(out[2]),
  607. .O3(out[3]),
  608. .O4(out[4]),
  609. .O5(out[5]),
  610. .O6(out[6]),
  611. .O7(out[7]),
  612. .O8(out[8]),
  613. .O9(out[9]),
  614. .O10(out[10]) );
  615. // INST_TAG_END
  616. endmodule
  617. /*
  618. // MOD_TAG
  619. module xilinx_mux2_11 (MA,MB,S,O); // synthesis black_box
  620. input [10 : 0] MA;
  621. input [10 : 0] MB;
  622. input [0 : 0] S;
  623. output [10 : 0] O;
  624. // synopsys translate_off
  625. // synthesis translate_off
  626. C_MUX_BUS_V1_0 #(
  627. "00000000000",
  628. 1,
  629. 0,
  630. 0,
  631. 0,
  632. 0,
  633. 0,
  634. 1,
  635. 0,
  636. 0,
  637. 0,
  638. 0,
  639. 2,
  640. 0,
  641. 1,
  642. "00000000000",
  643. 0,
  644. 1,
  645. 11)
  646. inst (
  647. .MA(MA),
  648. .MB(MB),
  649. .S(S),
  650. .O(O));
  651. // synthesis translate_on
  652. // synopsys translate_on
  653. endmodule
  654. // MOD_TAG_END
  655. */
  656. // 8bit Add/Sub with carry/borrow out
  657. module add_sub8_co(sub, opa, opb, out, co);
  658. input sub;
  659. input [7:0] opa, opb;
  660. output [7:0] out;
  661. output co;
  662. wire add;
  663. assign add = ~sub;
  664. // INST_TAG
  665. xilinx_add_sub8_co u0 (
  666. .A0(opa[0]),
  667. .A1(opa[1]),
  668. .A2(opa[2]),
  669. .A3(opa[3]),
  670. .A4(opa[4]),
  671. .A5(opa[5]),
  672. .A6(opa[6]),
  673. .A7(opa[7]),
  674. .B0(opb[0]),
  675. .B1(opb[1]),
  676. .B2(opb[2]),
  677. .B3(opb[3]),
  678. .B4(opb[4]),
  679. .B5(opb[5]),
  680. .B6(opb[6]),
  681. .B7(opb[7]),
  682. .C_OUT(co),
  683. .ADD(add),
  684. .S0(out[0]),
  685. .S1(out[1]),
  686. .S2(out[2]),
  687. .S3(out[3]),
  688. .S4(out[4]),
  689. .S5(out[5]),
  690. .S6(out[6]),
  691. .S7(out[7]) );
  692. // INST_TAG_END
  693. endmodule
  694. /*
  695. // MOD_TAG
  696. module xilinx_add_sub8_co (A,B,C_OUT,ADD,S); // synthesis black_box
  697. input [7 : 0] A;
  698. input [7 : 0] B;
  699. output C_OUT;
  700. input ADD;
  701. output [7 : 0] S;
  702. // synopsys translate_off
  703. // synthesis translate_off
  704. C_ADDSUB_V1_0 #(
  705. 2,
  706. "0000",
  707. 1,
  708. 8,
  709. 0,
  710. 0,
  711. 0,
  712. 1,
  713. "0",
  714. 8,
  715. 1,
  716. 0,
  717. 1,
  718. 0,
  719. 0,
  720. 0,
  721. 0,
  722. 0,
  723. 0,
  724. 0,
  725. 0,
  726. 0,
  727. 1,
  728. 0,
  729. 0,
  730. 0,
  731. 0,
  732. 0,
  733. 1,
  734. 0,
  735. 0,
  736. 0,
  737. 7,
  738. 0,
  739. 8,
  740. 1,
  741. "0",
  742. 0,
  743. 1)
  744. inst (
  745. .A(A),
  746. .B(B),
  747. .C_OUT(C_OUT),
  748. .ADD(ADD),
  749. .S(S));
  750. // synthesis translate_on
  751. // synopsys translate_on
  752. endmodule
  753. // MOD_TAG_END
  754. */
  755. // 11 bit incrementer
  756. module inc11(in, out);
  757. input [10:0] in;
  758. output [10:0] out;
  759. // INST_TAG
  760. xilinx_inc11 u0 (
  761. .A0(in[0]),
  762. .A1(in[1]),
  763. .A2(in[2]),
  764. .A3(in[3]),
  765. .A4(in[4]),
  766. .A5(in[5]),
  767. .A6(in[6]),
  768. .A7(in[7]),
  769. .A8(in[8]),
  770. .A9(in[9]),
  771. .A10(in[10]),
  772. .S0(out[0]),
  773. .S1(out[1]),
  774. .S2(out[2]),
  775. .S3(out[3]),
  776. .S4(out[4]),
  777. .S5(out[5]),
  778. .S6(out[6]),
  779. .S7(out[7]),
  780. .S8(out[8]),
  781. .S9(out[9]),
  782. .S10(out[10]) );
  783. // INST_TAG_END
  784. endmodule
  785. /*
  786. // MOD_TAG
  787. module xilinx_inc11 (A,S); // synthesis black_box
  788. input [10 : 0] A;
  789. output [10 : 0] S;
  790. // synopsys translate_off
  791. // synthesis translate_off
  792. C_ADDSUB_V1_0 #(
  793. 0,
  794. "0000",
  795. 1,
  796. 11,
  797. 0,
  798. 0,
  799. 1,
  800. 1,
  801. "0001",
  802. 11,
  803. 1,
  804. 0,
  805. 0,
  806. 0,
  807. 0,
  808. 0,
  809. 0,
  810. 0,
  811. 0,
  812. 0,
  813. 0,
  814. 0,
  815. 0,
  816. 0,
  817. 0,
  818. 0,
  819. 0,
  820. 0,
  821. 1,
  822. 0,
  823. 0,
  824. 0,
  825. 10,
  826. 0,
  827. 11,
  828. 1,
  829. "0",
  830. 0,
  831. 1)
  832. inst (
  833. .A(A),
  834. .S(S));
  835. // synthesis translate_on
  836. // synopsys translate_on
  837. endmodule
  838. // MOD_TAG_END
  839. */
  840. // 8 bit incrementer
  841. module inc8(in, out);
  842. input [7:0] in;
  843. output [7:0] out;
  844. // INST_TAG
  845. xilinx_inc8 u0 (
  846. .A0(in[0]),
  847. .A1(in[1]),
  848. .A2(in[2]),
  849. .A3(in[3]),
  850. .A4(in[4]),
  851. .A5(in[5]),
  852. .A6(in[6]),
  853. .A7(in[7]),
  854. .S0(out[0]),
  855. .S1(out[1]),
  856. .S2(out[2]),
  857. .S3(out[3]),
  858. .S4(out[4]),
  859. .S5(out[5]),
  860. .S6(out[6]),
  861. .S7(out[7]) );
  862. // INST_TAG_END
  863. endmodule
  864. /*
  865. // MOD_TAG
  866. module xilinx_inc8 (A,S); // synthesis black_box
  867. input [7 : 0] A;
  868. output [7 : 0] S;
  869. // synopsys translate_off
  870. // synthesis translate_off
  871. C_ADDSUB_V1_0 #(
  872. 0,
  873. "0000",
  874. 1,
  875. 8,
  876. 0,
  877. 0,
  878. 1,
  879. 1,
  880. "0001",
  881. 8,
  882. 1,
  883. 0,
  884. 0,
  885. 0,
  886. 0,
  887. 0,
  888. 0,
  889. 0,
  890. 0,
  891. 0,
  892. 0,
  893. 0,
  894. 0,
  895. 0,
  896. 0,
  897. 0,
  898. 0,
  899. 0,
  900. 1,
  901. 0,
  902. 0,
  903. 0,
  904. 7,
  905. 0,
  906. 8,
  907. 1,
  908. "0",
  909. 0,
  910. 1)
  911. inst (
  912. .A(A),
  913. .S(S));
  914. // synthesis translate_on
  915. // synopsys translate_on
  916. endmodule
  917. // MOD_TAG_END
  918. */
  919. // A Basic Synchrounous FIFO (4 entries deep)
  920. module sfifo4x11(clk, push, din, pop, dout);
  921. input clk;
  922. input push;
  923. input [10:0] din;
  924. input pop;
  925. output [10:0] dout;
  926. reg [10:0] stack1, stack2, stack3, stack4;
  927. assign dout = stack1;
  928. always @(posedge clk)
  929.    begin
  930. if(push) // PUSH stack
  931.    begin
  932. stack4 <= #1 stack3;
  933. stack3 <= #1 stack2;
  934.     stack2 <= #1 stack1;
  935. stack1 <= #1 din;
  936.    end
  937. if(pop) // POP stack
  938.    begin
  939. stack1 <= #1 stack2;
  940. stack2 <= #1 stack3;
  941. stack3 <= #1 stack4;
  942.    end
  943.    end
  944. endmodule
  945. // Synchrounous SRAM
  946. // 128 bytes by 8 bits
  947. // 1 read port, 1 write port
  948. // FOR XILINX VERTEX SERIES
  949. module ssram_128x8(clk, rd_addr, rd_data, we, wr_addr, wr_data);
  950. input clk;
  951. input [6:0] rd_addr;
  952. output [7:0] rd_data;
  953. input we;
  954. input [6:0] wr_addr;
  955. input [7:0] wr_data;
  956. wire [7:0] tmp;
  957. // Alternatively RAMs can be instantiated directly
  958. RAMB4_S8_S8 u0(
  959. .DOA( rd_data ),
  960. .ADDRA( {2'b0, rd_addr} ),
  961. .DIA( 8'h00 ),
  962. .ENA( 1'b1 ),
  963. .CLKA( clk ),
  964. .WEA( 1'b0 ),
  965. .RSTA( 1'b0 ),
  966. .DOB( tmp ),
  967. .ADDRB( {2'b0, wr_addr} ),
  968. .DIB( wr_data ),
  969. .ENB( 1'b1 ),
  970. .CLKB( clk ),
  971. .WEB( we ),
  972. .RSTB( 1'b0 ) );
  973. endmodule
  974. // This block is the global Set/Rest for Xilinx VIrtex Serries
  975. // Connect it up as described in Xilinx documentation
  976. // Leave it out for Non Xilinx implementations
  977. module glbl(rst);
  978. input rst;
  979. wire GSR;
  980. assign GSR = rst;
  981. endmodule