1 //////////////////////////////////////////////////////////////////////
3 //// File name "pci_io_mux.v" ////
5 //// This file is part of the "PCI bridge" project ////
6 //// http://www.opencores.org/cores/pci/ ////
9 //// - Miha Dolenc (mihad@opencores.org) ////
11 //// All additional information is avaliable in the README ////
15 //////////////////////////////////////////////////////////////////////
17 //// Copyright (C) 2001 Miha Dolenc, mihad@opencores.org ////
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. ////
24 //// This source file is free software; you can redistribute it ////
25 //// and/or modify it under the terms of the GNU Lesser General ////
26 //// Public License as published by the Free Software Foundation; ////
27 //// either version 2.1 of the License, or (at your option) any ////
28 //// later version. ////
30 //// This source is distributed in the hope that it will be ////
31 //// useful, but WITHOUT ANY WARRANTY; without even the implied ////
32 //// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
33 //// PURPOSE. See the GNU Lesser General Public License for more ////
36 //// You should have received a copy of the GNU Lesser General ////
37 //// Public License along with this source; if not, download it ////
38 //// from http://www.opencores.org/lgpl.shtml ////
40 //////////////////////////////////////////////////////////////////////
42 // CVS Revision History
44 // $Log: pci_io_mux.v,v $
45 // Revision 1.1 2007-03-20 17:50:56 sithglan
48 // Revision 1.5 2003/12/19 11:11:30 mihad
49 // Compact PCI Hot Swap support added.
50 // New testcases added.
51 // Specification updated.
52 // Test application changed to support WB B3 cycles.
54 // Revision 1.4 2003/01/27 16:49:31 mihad
55 // Changed module and file names. Updated scripts accordingly. FIFO synchronizations changed.
57 // Revision 1.3 2002/02/01 15:25:12 mihad
58 // Repaired a few bugs, updated specification, added test bench files and design document
60 // Revision 1.2 2001/10/05 08:14:29 mihad
61 // Updated all files with inclusion of timescale file for simulation purposes.
63 // Revision 1.1.1.1 2001/10/02 15:33:46 mihad
64 // New project directory structure
68 // this module instantiates output flip flops for PCI interface and
69 // some fanout downsizing logic because of heavily constrained PCI signals
71 // synopsys translate_off
72 `include "timescale.v"
73 // synopsys translate_on
91 master_load_on_transfer_in,
93 target_load_on_transfer_in,
128 ad_en_unregistered_out,
147 input reset_in, clk_in ;
151 input frame_load_in ;
160 input master_load_in ;
161 input target_load_in ;
165 input [31:0] mas_ad_in ;
166 input [31:0] tar_ad_in ;
170 input tar_ad_en_reg_in ;
179 output frame_en_out ;
181 output devsel_en_out ;
184 output [31:0] ad_en_out ;
185 output [3:0] cbe_en_out ;
192 output [3:0] cbe_out ;
193 output [31:0] ad_out ;
195 output ad_en_unregistered_out ;
214 input master_load_on_transfer_in ;
215 input target_load_on_transfer_in ;
217 input init_complete_in ;
219 wire [31:0] temp_ad = tar_ad_en_reg_in ? tar_ad_in : mas_ad_in ;
221 wire ad_en_ctrl_low ;
223 wire ad_en_ctrl_mlow ;
225 wire ad_en_ctrl_mhigh ;
227 wire ad_en_ctrl_high ;
229 wire ad_enable_internal = mas_ad_en_in || tar_ad_en_in ;
231 pci_io_mux_ad_en_crit ad_en_low_gen
233 .ad_en_in (ad_enable_internal),
234 .pci_frame_in (pci_frame_in),
235 .pci_trdy_in (pci_trdy_in),
236 .pci_stop_in (pci_stop_in),
237 .ad_en_out (ad_en_ctrl_low)
240 pci_io_mux_ad_en_crit ad_en_mlow_gen
242 .ad_en_in (ad_enable_internal),
243 .pci_frame_in (pci_frame_in),
244 .pci_trdy_in (pci_trdy_in),
245 .pci_stop_in (pci_stop_in),
246 .ad_en_out (ad_en_ctrl_mlow)
249 pci_io_mux_ad_en_crit ad_en_mhigh_gen
251 .ad_en_in (ad_enable_internal),
252 .pci_frame_in (pci_frame_in),
253 .pci_trdy_in (pci_trdy_in),
254 .pci_stop_in (pci_stop_in),
255 .ad_en_out (ad_en_ctrl_mhigh)
258 pci_io_mux_ad_en_crit ad_en_high_gen
260 .ad_en_in (ad_enable_internal),
261 .pci_frame_in (pci_frame_in),
262 .pci_trdy_in (pci_trdy_in),
263 .pci_stop_in (pci_stop_in),
264 .ad_en_out (ad_en_ctrl_high)
267 assign ad_en_unregistered_out = ad_en_ctrl_high ;
269 wire load = master_load_in || target_load_in ;
270 wire load_on_transfer = master_load_on_transfer_in || target_load_on_transfer_in ;
272 wire ad_load_ctrl_low ;
273 wire ad_load_ctrl_mlow ;
274 wire ad_load_ctrl_mhigh ;
275 wire ad_load_ctrl_high ;
277 assign ad_load_out = ad_load_ctrl_high ;
279 pci_io_mux_ad_load_crit ad_load_low_gen
282 .load_on_transfer_in(load_on_transfer),
283 .pci_irdy_in(pci_irdy_in),
284 .pci_trdy_in(pci_trdy_in),
285 .load_out(ad_load_ctrl_low)
288 pci_io_mux_ad_load_crit ad_load_mlow_gen
291 .load_on_transfer_in(load_on_transfer),
292 .pci_irdy_in(pci_irdy_in),
293 .pci_trdy_in(pci_trdy_in),
294 .load_out(ad_load_ctrl_mlow)
297 pci_io_mux_ad_load_crit ad_load_mhigh_gen
300 .load_on_transfer_in(load_on_transfer),
301 .pci_irdy_in(pci_irdy_in),
302 .pci_trdy_in(pci_trdy_in),
303 .load_out(ad_load_ctrl_mhigh)
306 pci_io_mux_ad_load_crit ad_load_high_gen
309 .load_on_transfer_in(load_on_transfer),
310 .pci_irdy_in(pci_irdy_in),
311 .pci_trdy_in(pci_trdy_in),
312 .load_out(ad_load_ctrl_high)
317 .reset_in ( reset_in ),
319 .dat_en_in ( ad_load_ctrl_low ),
321 .dat_in ( temp_ad[0] ) ,
322 .en_in ( ad_en_ctrl_low ) ,
323 .en_out ( ad_en_out[0] ),
324 .dat_out ( ad_out[0] )
329 .reset_in ( reset_in ),
331 .dat_en_in ( ad_load_ctrl_low ),
333 .dat_in ( temp_ad[1] ) ,
334 .en_in ( ad_en_ctrl_low ) ,
335 .en_out ( ad_en_out[1] ),
336 .dat_out ( ad_out[1] )
341 .reset_in ( reset_in ),
343 .dat_en_in ( ad_load_ctrl_low ),
345 .dat_in ( temp_ad[2] ) ,
346 .en_in ( ad_en_ctrl_low ) ,
347 .en_out ( ad_en_out[2] ),
348 .dat_out ( ad_out[2] )
353 .reset_in ( reset_in ),
355 .dat_en_in ( ad_load_ctrl_low ),
357 .dat_in ( temp_ad[3] ) ,
358 .en_in ( ad_en_ctrl_low ) ,
359 .en_out ( ad_en_out[3] ),
360 .dat_out ( ad_out[3] )
365 .reset_in ( reset_in ),
367 .dat_en_in ( ad_load_ctrl_low ),
369 .dat_in ( temp_ad[4] ) ,
370 .en_in ( ad_en_ctrl_low ) ,
371 .en_out ( ad_en_out[4] ),
372 .dat_out ( ad_out[4] )
377 .reset_in ( reset_in ),
379 .dat_en_in ( ad_load_ctrl_low ),
381 .dat_in ( temp_ad[5] ) ,
382 .en_in ( ad_en_ctrl_low ) ,
383 .en_out ( ad_en_out[5] ),
384 .dat_out ( ad_out[5] )
389 .reset_in ( reset_in ),
391 .dat_en_in ( ad_load_ctrl_low ),
393 .dat_in ( temp_ad[6] ) ,
394 .en_in ( ad_en_ctrl_low ) ,
395 .en_out ( ad_en_out[6] ),
396 .dat_out ( ad_out[6] )
401 .reset_in ( reset_in ),
403 .dat_en_in ( ad_load_ctrl_low ),
405 .dat_in ( temp_ad[7] ) ,
406 .en_in ( ad_en_ctrl_low ) ,
407 .en_out ( ad_en_out[7] ),
408 .dat_out ( ad_out[7] )
413 .reset_in ( reset_in ),
415 .dat_en_in ( ad_load_ctrl_mlow ),
417 .dat_in ( temp_ad[8] ) ,
418 .en_in ( ad_en_ctrl_mlow ) ,
419 .en_out ( ad_en_out[8] ),
420 .dat_out ( ad_out[8] )
425 .reset_in ( reset_in ),
427 .dat_en_in ( ad_load_ctrl_mlow ),
429 .dat_in ( temp_ad[9] ) ,
430 .en_in ( ad_en_ctrl_mlow ) ,
431 .en_out ( ad_en_out[9] ),
432 .dat_out ( ad_out[9] )
437 .reset_in ( reset_in ),
439 .dat_en_in ( ad_load_ctrl_mlow ),
441 .dat_in ( temp_ad[10] ) ,
442 .en_in ( ad_en_ctrl_mlow ) ,
443 .en_out ( ad_en_out[10] ),
444 .dat_out ( ad_out[10] )
449 .reset_in ( reset_in ),
451 .dat_en_in ( ad_load_ctrl_mlow ),
453 .dat_in ( temp_ad[11] ) ,
454 .en_in ( ad_en_ctrl_mlow ) ,
455 .en_out ( ad_en_out[11] ),
456 .dat_out ( ad_out[11] )
461 .reset_in ( reset_in ),
463 .dat_en_in ( ad_load_ctrl_mlow ),
465 .dat_in ( temp_ad[12] ) ,
466 .en_in ( ad_en_ctrl_mlow ) ,
467 .en_out ( ad_en_out[12] ),
468 .dat_out ( ad_out[12] )
473 .reset_in ( reset_in ),
475 .dat_en_in ( ad_load_ctrl_mlow ),
477 .dat_in ( temp_ad[13] ) ,
478 .en_in ( ad_en_ctrl_mlow ) ,
479 .en_out ( ad_en_out[13] ),
480 .dat_out ( ad_out[13] )
485 .reset_in ( reset_in ),
487 .dat_en_in ( ad_load_ctrl_mlow ),
489 .dat_in ( temp_ad[14] ) ,
490 .en_in ( ad_en_ctrl_mlow ) ,
491 .en_out ( ad_en_out[14] ),
492 .dat_out ( ad_out[14] )
497 .reset_in ( reset_in ),
499 .dat_en_in ( ad_load_ctrl_mlow ),
501 .dat_in ( temp_ad[15] ) ,
502 .en_in ( ad_en_ctrl_mlow ) ,
503 .en_out ( ad_en_out[15] ),
504 .dat_out ( ad_out[15] )
509 .reset_in ( reset_in ),
511 .dat_en_in ( ad_load_ctrl_mhigh ),
513 .dat_in ( temp_ad[16] ) ,
514 .en_in ( ad_en_ctrl_mhigh ) ,
515 .en_out ( ad_en_out[16] ),
516 .dat_out ( ad_out[16] )
521 .reset_in ( reset_in ),
523 .dat_en_in ( ad_load_ctrl_mhigh ),
525 .dat_in ( temp_ad[17] ) ,
526 .en_in ( ad_en_ctrl_mhigh ) ,
527 .en_out ( ad_en_out[17] ),
528 .dat_out ( ad_out[17] )
533 .reset_in ( reset_in ),
535 .dat_en_in ( ad_load_ctrl_mhigh ),
537 .dat_in ( temp_ad[18] ) ,
538 .en_in ( ad_en_ctrl_mhigh ) ,
539 .en_out ( ad_en_out[18] ),
540 .dat_out ( ad_out[18] )
545 .reset_in ( reset_in ),
547 .dat_en_in ( ad_load_ctrl_mhigh ),
549 .dat_in ( temp_ad[19] ) ,
550 .en_in ( ad_en_ctrl_mhigh ) ,
551 .en_out ( ad_en_out[19] ),
552 .dat_out ( ad_out[19] )
557 .reset_in ( reset_in ),
559 .dat_en_in ( ad_load_ctrl_mhigh ),
561 .dat_in ( temp_ad[20] ) ,
562 .en_in ( ad_en_ctrl_mhigh ) ,
563 .en_out ( ad_en_out[20] ),
564 .dat_out ( ad_out[20] )
569 .reset_in ( reset_in ),
571 .dat_en_in ( ad_load_ctrl_mhigh ),
573 .dat_in ( temp_ad[21] ) ,
574 .en_in ( ad_en_ctrl_mhigh ) ,
575 .en_out ( ad_en_out[21] ),
576 .dat_out ( ad_out[21] )
581 .reset_in ( reset_in ),
583 .dat_en_in ( ad_load_ctrl_mhigh ),
585 .dat_in ( temp_ad[22] ) ,
586 .en_in ( ad_en_ctrl_mhigh ) ,
587 .en_out ( ad_en_out[22] ),
588 .dat_out ( ad_out[22] )
593 .reset_in ( reset_in ),
595 .dat_en_in ( ad_load_ctrl_mhigh ),
597 .dat_in ( temp_ad[23] ) ,
598 .en_in ( ad_en_ctrl_mhigh ) ,
599 .en_out ( ad_en_out[23] ),
600 .dat_out ( ad_out[23] )
605 .reset_in ( reset_in ),
607 .dat_en_in ( ad_load_ctrl_high ),
609 .dat_in ( temp_ad[24] ) ,
610 .en_in ( ad_en_ctrl_high ) ,
611 .en_out ( ad_en_out[24] ),
612 .dat_out ( ad_out[24] )
617 .reset_in ( reset_in ),
619 .dat_en_in ( ad_load_ctrl_high ),
621 .dat_in ( temp_ad[25] ) ,
622 .en_in ( ad_en_ctrl_high ) ,
623 .en_out ( ad_en_out[25] ),
624 .dat_out ( ad_out[25] )
629 .reset_in ( reset_in ),
631 .dat_en_in ( ad_load_ctrl_high ),
633 .dat_in ( temp_ad[26] ) ,
634 .en_in ( ad_en_ctrl_high ) ,
635 .en_out ( ad_en_out[26] ),
636 .dat_out ( ad_out[26] )
641 .reset_in ( reset_in ),
643 .dat_en_in ( ad_load_ctrl_high ),
645 .dat_in ( temp_ad[27] ) ,
646 .en_in ( ad_en_ctrl_high ) ,
647 .en_out ( ad_en_out[27] ),
648 .dat_out ( ad_out[27] )
653 .reset_in ( reset_in ),
655 .dat_en_in ( ad_load_ctrl_high ),
657 .dat_in ( temp_ad[28] ) ,
658 .en_in ( ad_en_ctrl_high ) ,
659 .en_out ( ad_en_out[28] ),
660 .dat_out ( ad_out[28] )
665 .reset_in ( reset_in ),
667 .dat_en_in ( ad_load_ctrl_high ),
669 .dat_in ( temp_ad[29] ) ,
670 .en_in ( ad_en_ctrl_high ) ,
671 .en_out ( ad_en_out[29] ),
672 .dat_out ( ad_out[29] )
677 .reset_in ( reset_in ),
679 .dat_en_in ( ad_load_ctrl_high ),
681 .dat_in ( temp_ad[30] ) ,
682 .en_in ( ad_en_ctrl_high ) ,
683 .en_out ( ad_en_out[30] ),
684 .dat_out ( ad_out[30] )
689 .reset_in ( reset_in ),
691 .dat_en_in ( ad_load_ctrl_high ),
693 .dat_in ( temp_ad[31] ) ,
694 .en_in ( ad_en_ctrl_high ) ,
695 .en_out ( ad_en_out[31] ),
696 .dat_out ( ad_out[31] )
699 wire [3:0] cbe_load_ctrl = {4{ master_load_in }} ;
700 wire [3:0] cbe_en_ctrl = {4{ cbe_en_in }} ;
704 .reset_in ( reset_in ),
706 .dat_en_in ( cbe_load_ctrl[0] ),
708 .dat_in ( cbe_in[0] ) ,
709 .en_in ( cbe_en_ctrl[0] ) ,
710 .en_out ( cbe_en_out[0] ),
711 .dat_out ( cbe_out[0] )
716 .reset_in ( reset_in ),
718 .dat_en_in ( cbe_load_ctrl[1] ),
720 .dat_in ( cbe_in[1] ) ,
721 .en_in ( cbe_en_ctrl[1] ) ,
722 .en_out ( cbe_en_out[1] ),
723 .dat_out ( cbe_out[1] )
728 .reset_in ( reset_in ),
730 .dat_en_in ( cbe_load_ctrl[2] ),
732 .dat_in ( cbe_in[2] ) ,
733 .en_in ( cbe_en_ctrl[2] ) ,
734 .en_out ( cbe_en_out[2] ),
735 .dat_out ( cbe_out[2] )
740 .reset_in ( reset_in ),
742 .dat_en_in ( cbe_load_ctrl[3] ),
744 .dat_in ( cbe_in[3] ) ,
745 .en_in ( cbe_en_ctrl[3] ) ,
746 .en_out ( cbe_en_out[3] ),
747 .dat_out ( cbe_out[3] )
750 pci_out_reg frame_iob
752 .reset_in ( reset_in ),
754 .dat_en_in ( frame_load_in ),
756 .dat_in ( frame_in ) ,
757 .en_in ( frame_en_in ) ,
758 .en_out ( frame_en_out ),
759 .dat_out ( frame_out )
764 .reset_in ( reset_in ),
768 .dat_in ( irdy_in ) ,
769 .en_in ( irdy_en_in ) ,
770 .en_out ( irdy_en_out ),
771 .dat_out ( irdy_out )
776 .reset_in ( reset_in ),
780 .dat_in ( trdy_in ) ,
781 .en_in ( trdy_en_in ) ,
782 .en_out ( trdy_en_out ),
783 .dat_out ( trdy_out )
788 .reset_in ( reset_in ),
792 .dat_in ( stop_in ) ,
793 .en_in ( stop_en_in ) ,
794 .en_out ( stop_en_out ),
795 .dat_out ( stop_out )
798 pci_out_reg devsel_iob
800 .reset_in ( reset_in ),
804 .dat_in ( devsel_in ) ,
805 .en_in ( devsel_en_in ) ,
806 .en_out ( devsel_en_out ),
807 .dat_out ( devsel_out )
812 .reset_in ( reset_in ),
817 .en_in ( par_en_in ) ,
818 .en_out ( par_en_out ),
824 .reset_in ( reset_in ),
828 .dat_in ( perr_in ) ,
829 .en_in ( perr_en_in ) ,
830 .en_out ( perr_en_out ),
831 .dat_out ( perr_out )
836 .reset_in ( reset_in ),
840 .dat_in ( serr_in ) ,
841 .en_in ( serr_en_in ) ,
842 .en_out ( serr_en_out ),
843 .dat_out ( serr_out )
848 .reset_in ( reset_in ),
853 .en_in ( init_complete_in ) ,
854 .en_out ( req_en_out ),