aboutsummaryrefslogtreecommitdiff
`default_nettype none

module slave_dispatcher
  (
   input wire 	      CLK,
   input wire 	      RST,

   input wire 	      S0_ACK_O,
   output wire [17:0] S0_ADR_I,
   output wire [15:0] S0_DAT_I,
   input wire [15:0]  S0_DAT_O,
   output wire 	      S0_STB_I,
   output wire 	      S0_WE_I,
   input wire 	      S0_STALL_O,

   input wire 	      S1_ACK_O,
   output wire [17:0] S1_ADR_I,
   output wire [15:0] S1_DAT_I,
   input wire [15:0]  S1_DAT_O,
   output wire 	      S1_STB_I,
   output wire 	      S1_WE_I,
   input wire 	      S1_STALL_O,

   input wire 	      S2_ACK_O,
   output wire [16:0] S2_ADR_I,
   output wire [15:0] S2_DAT_I,
   input wire [15:0]  S2_DAT_O,
   output wire 	      S2_STB_I,
   output wire 	      S2_WE_I,
   input wire 	      S2_STALL_O,

   input wire 	      S3_ACK_O,
   output wire [16:0] S3_ADR_I,
   output wire [15:0] S3_DAT_I,
   input wire [15:0]  S3_DAT_O,
   output wire 	      S3_STB_I,
   output wire 	      S3_WE_I,
   input wire 	      S3_STALL_O,

   input wire 	      S4_ACK_O,
   output wire [16:0] S4_ADR_I,
   output wire [15:0] S4_DAT_I,
   input wire [15:0]  S4_DAT_O,
   output wire 	      S4_STB_I,
   output wire 	      S4_WE_I,
   input wire 	      S4_STALL_O,

   input wire 	      S5_ACK_O,
   output wire [16:0] S5_ADR_I,
   output wire [15:0] S5_DAT_I,
   input wire [15:0]  S5_DAT_O,
   output wire 	      S5_STB_I,
   output wire 	      S5_WE_I,
   input wire 	      S5_STALL_O,

   output wire 	      S_COMBINED_ACK_O,
   input wire [19:0]  S_COMBINED_ADR_I,
   input wire [15:0]  S_COMBINED_DAT_I,
   output wire [15:0] S_COMBINED_DAT_O,
   input wire 	      S_COMBINED_STB_I,
   input wire 	      S_COMBINED_WE_I,
   output wire 	      S_COMBINED_STALL_O
   );

   wire [0:5] 	      acks;
   wire [0:5] 	      stalls;
   wire [15:0] 	      datas [0:5];
   assign acks = {S0_ACK_O, S1_ACK_O, S2_ACK_O, S3_ACK_O, S4_ACK_O, S5_ACK_O};
   assign stalls = {S0_STALL_O, S1_STALL_O, S2_STALL_O,
		    S3_STALL_O, S4_STALL_O, S5_STALL_O};
   assign datas[0] = S0_DAT_O;
   assign datas[1] = S1_DAT_O;
   assign datas[2] = S2_DAT_O;
   assign datas[3] = S3_DAT_O;
   assign datas[4] = S4_DAT_O;
   assign datas[5] = S5_DAT_O;

   reg [1:0] 	      commands_awaiting;
   reg [2:0] 	      slave_last_accessed;

   wire 	      working;
   wire [2:0] 	      slave_accessed;
   wire [2:0] 	      slave_requested;
   wire 	      slave_switch;
   wire [1:0] 	      commands_awaiting_next_tick;
   assign working = commands_awaiting || S_COMBINED_STB_I;
   assign slave_requested = S_COMBINED_ADR_I[19] ?
			    /* one of 4 smaller slaves */
			    S_COMBINED_ADR_I[18:17] + 2 :
			    /* one of 2 bigger slaves */
			    S_COMBINED_ADR_I[19:18];
   assign slave_accessed = commands_awaiting ? slave_last_accessed :
			   slave_requested;
   assign S_COMBINED_ACK_O = acks[slave_accessed] && working;
   assign S_COMBINED_DAT_O = datas[slave_accessed];
   assign slave_switch = slave_accessed != slave_requested;
   assign S_COMBINED_STALL_O = stalls[slave_accessed] || slave_switch ||
			       (commands_awaiting == 3 && !S_COMBINED_ACK_O);
   assign commands_awaiting_next_tick
     = commands_awaiting - S_COMBINED_ACK_O +
       (S_COMBINED_STB_I && !S_COMBINED_STALL_O);

`ifdef SIMULATION
   /* anything could be latched here, this is just to avoid undefined values */
   initial begin
      slave_last_accessed <= 0;
      commands_awaiting <= 2; /* It is supposed to be driven low by RST */
   end
`endif

   always @ (posedge CLK) begin
      slave_last_accessed <= slave_accessed;

      if (RST)
	commands_awaiting <= 0;
      else
	commands_awaiting <= commands_awaiting_next_tick;
   end

   assign S0_ADR_I = S_COMBINED_ADR_I[17:0];
   assign S1_ADR_I = S_COMBINED_ADR_I[17:0];
   assign S2_ADR_I = S_COMBINED_ADR_I[16:0];
   assign S3_ADR_I = S_COMBINED_ADR_I[16:0];
   assign S4_ADR_I = S_COMBINED_ADR_I[16:0];
   assign S5_ADR_I = S_COMBINED_ADR_I[16:0];

   assign S0_DAT_I = S_COMBINED_DAT_I;
   assign S1_DAT_I = S_COMBINED_DAT_I;
   assign S2_DAT_I = S_COMBINED_DAT_I;
   assign S3_DAT_I = S_COMBINED_DAT_I;
   assign S4_DAT_I = S_COMBINED_DAT_I;
   assign S5_DAT_I = S_COMBINED_DAT_I;

   wire pass_strobe;
   assign pass_strobe = S_COMBINED_STB_I && !slave_switch &&
			(commands_awaiting != 3 || S_COMBINED_ACK_O);

   assign S0_STB_I = slave_accessed == 0 && pass_strobe;
   assign S1_STB_I = slave_accessed == 1 && pass_strobe;
   assign S2_STB_I = slave_accessed == 2 && pass_strobe;
   assign S3_STB_I = slave_accessed == 3 && pass_strobe;
   assign S4_STB_I = slave_accessed == 4 && pass_strobe;
   assign S5_STB_I = slave_accessed == 5 && pass_strobe;

   assign S0_WE_I = S_COMBINED_WE_I;
   assign S1_WE_I = S_COMBINED_WE_I;
   assign S2_WE_I = S_COMBINED_WE_I;
   assign S3_WE_I = S_COMBINED_WE_I;
   assign S4_WE_I = S_COMBINED_WE_I;
   assign S5_WE_I = S_COMBINED_WE_I;
endmodule // slave_dispatcher
e to commit 806c1ee....* gnu/packages/emulators.scm (dolphin-emu): Update to commit 806c1ee. [source]: Don't delete removed externals. [arguments]: Remove unused variables. [inputs]: Add 'pugixml. Remove 'wxwidgets-gtk2-3.1. Rutger Helling 2018-06-29gnu: mame: Update to 0.199....* gnu/packages/emulators.scm (mame): Update to 0.199. Tobias Geerinckx-Rice 2018-06-12gnu: mame: Fix renaming executable....* gnu/packages/emulators.scm (mame)[arguments]: Only rename 'mame64' to 'mame' when 'mame64' exists. Efraim Flashner 2018-06-09gnu: mame: New variable....* gnu/packages/emulators.scm (mame): New variable. Nicolas Goaziou 2018-06-06Merge branch 'master' into core-updatesRicardo Wurmus 2018-06-06gnu: vulkan-loader: Update URL and change name....* gnu/packages/emulators.scm: Change references from 'vulkan-icd-loader' to 'vulkan-loader'. * gnu/packages/games.scm: Change references from 'vulkan-icd-loader' to 'vulkan-loader'. * gnu/packages/video.scm: Change references from 'vulkan-icd-loader' to 'vulkan-loader'. * gnu/packages/vulkan.scm (vulkan-loader): Rename from 'vulkan-icd-loader' to 'vulkan-loader'. Update URL and hash. * gnu/packages/wine.scm: Change references from 'vulkan-icd-loader' to 'vulkan-loader'. Rutger Helling 2018-05-27Merge branch 'master' into core-updatesMark H Weaver 2018-05-25gnu: Add scummvm....* gnu/packages/emulators.scm (scummvm): New variable. Nicolas Goaziou 2018-05-17Merge branch 'master' into core-updatesMark H Weaver 2018-05-16gnu: dolphin-emu: Update to commit 47fd8c6eff4cdea7660d0fa78040f98d1d4fa136....* gnu/packages/emulators.scm (dolphin-emu): Update to commit 47fd8c6eff4cdea7660d0fa78040f98d1d4fa136. [arguments]: Add 'fixgcc7 phase. [native-inputs]: Add gcc@7 since building with gcc@5 doesn't work anymore. Rutger Helling 2018-05-06Merge branch 'master' into core-updatesMarius Bakke 2018-05-05gnu: retroarch: Update to 1.7.3....* gnu/packages/emulators.scm (retroarch): Update to 1.7.3. [inputs]: Add qtbase. Rutger Helling 2018-04-30Merge branch 'master' into core-updatesMark H Weaver 2018-04-26gnu: retroarch: Fix hash....* gnu/packages/emulators.scm (retroarch): Fix incorrect hash. Rutger Helling 2018-04-24gnu: retroarch: Update to 1.7.2....* gnu/packages/emulators.scm (retroarch): Update to 1.7.2. Rutger Helling 2018-04-23gnu: ffmpeg: Update to 4.0....* gnu/packages/video.scm (ffmpeg): Update to 4.0. * gnu/packages/video.scm (ffmpeg@3.4): New variable. * gnu/packages/video.scm (ffmpeg-git): Remove variable. * gnu/packages/video.scm (mpv)[inputs]: Build with ffmpeg instead of ffmpeg-git. * gnu/packages/gstreamer.scm (gst-libav)[inputs]: Build with ffmpeg@3.4 instead of ffmpeg. * gnu/packages/messaging.scm (qtox)[inputs]: Build with ffmpeg@3.4 instead of ffmpeg. * gnu/packages/emulators.scm (dolphin-emu)[inputs]: Build with ffmpeg@3.4 instead of ffmpeg. * gnu/packages/gnunet.scm (libextractor)[inputs]: Build with ffmpeg@3.4 instead of ffmpeg. Rutger Helling 2018-04-21Merge branch 'master' into core-updatesMark H Weaver 2018-04-17gnu: nestopia-ue: Update to 1.48....* gnu/packages/emulators.scm (nestopia-ue): Update to 1.48. [source]: Simplify snippet; 3rd-party zlib is no longer bundled. [build-system]: Switch to cmake-build-system. [inputs]: Remove glu and mesa. Add libepoxy. [arguments]: Remove #:make-flags. Re-enable 'configure' phase. Remove 'remove-xdg-desktop-menu-call' and 'remove-gdkwayland-include' phases. Add 'wrap-program' phase. Kei Kebreau 2018-04-15gnu: mupen64plus-video-z64: Fix glew.h location....* gnu/packages/patches/mupen64plus-video-z64-glew-correct-path.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/emulators.scm (mupen64plus-video-z64)[source]: Use it. Manolis Ragkousis 2018-04-15gnu: mgba: Update to 0.6.3....* gnu/packages/emulators.scm (mgba): Update to 0.6.3. Rutger Helling 2018-04-10Merge branch 'master' into core-updatesMark H Weaver 2018-04-09gnu: retroarch: Update checksum....* gnu/packages/emulators.scm (retroarch): Update checksum. Rutger Helling 2018-04-09gnu: mgba: Update to 0.6.2....* gnu/packages/emulators.scm (mgba): Update to 0.6.2. Rutger Helling 2018-03-20Merge branch 'master' into core-updatesMark H Weaver 2018-03-17gnu: Fix common unquote typos....It's easy to mistype ‘("foo" foo)’ as ‘("foo", foo)’ (which also works). Fix such typos for the proper edification of our young. * gnu/packages/android.scm: Move unquotes to their operands. * gnu/packages/bootloaders.scm: Likewise. * gnu/packages/build-tools.scm: Likewise. * gnu/packages/chemistry.scm: Likewise. * gnu/packages/compression.scm: Likewise. * gnu/packages/connman.scm: Likewise. * gnu/packages/django.scm: Likewise. * gnu/packages/emulators.scm: Likewise. * gnu/packages/engineering.scm: Likewise. * gnu/packages/file-systems.scm: Likewise. * gnu/packages/freedesktop.scm: Likewise. * gnu/packages/games.scm: Likewise. * gnu/packages/gimp.scm: Likewise. * gnu/packages/gl.scm: Likewise. * gnu/packages/gnome.scm: Likewise. * gnu/packages/graphics.scm: Likewise. * gnu/packages/haskell.scm: Likewise. * gnu/packages/irc.scm: Likewise. * gnu/packages/julia.scm: Likewise. * gnu/packages/kde-frameworks.scm: Likewise. * gnu/packages/linux.scm: Likewise. * gnu/packages/lua.scm: Likewise. * gnu/packages/mail.scm: Likewise. * gnu/packages/make-bootstrap.scm: Likewise. * gnu/packages/messaging.scm: Likewise. * gnu/packages/music.scm: Likewise. * gnu/packages/networking.scm: Likewise. * gnu/packages/ocaml.scm: Likewise. * gnu/packages/perl.scm: Likewise. * gnu/packages/python.scm: Likewise. * gnu/packages/python-web.scm: Likewise. * gnu/packages/qt.scm: Likewise. * gnu/packages/ratpoison.scm: Likewise. * gnu/packages/sdl.scm: Likewise. * gnu/packages/sml.scm: Likewise. * gnu/packages/terminals.scm: Likewise. * gnu/packages/text-editors.scm: Likewise. * gnu/packages/video.scm: Likewise. * gnu/packages/virtualization.scm: Likewise. * gnu/packages/vulkan.scm: Likewise. * gnu/packages/wget.scm: Likewise. * gnu/packages/wine.scm: Likewise. * gnu/packages/wm.scm: Likewise. * gnu/packages/xdisorg.scm: Likewise. * gnu/packages/xml.scm: Likewise. * gnu/packages/xorg.scm: Likewise. Tobias Geerinckx-Rice 2018-03-16gnu: All snippets report errors using exceptions, else return #t....* gnu/packages/admin.scm, gnu/packages/algebra.scm, gnu/packages/audio.scm, gnu/packages/backup.scm, gnu/packages/base.scm, gnu/packages/bioinformatics.scm, gnu/packages/cdrom.scm, gnu/packages/chez.scm, gnu/packages/code.scm, gnu/packages/compression.scm, gnu/packages/cross-base.scm, gnu/packages/crypto.scm, gnu/packages/cups.scm, gnu/packages/databases.scm, gnu/packages/dns.scm, gnu/packages/emacs.scm, gnu/packages/emulators.scm, gnu/packages/engineering.scm, gnu/packages/enlightenment.scm, gnu/packages/fpga.scm, gnu/packages/freedesktop.scm, gnu/packages/ftp.scm, gnu/packages/games.scm, gnu/packages/gcc.scm, gnu/packages/geo.scm, gnu/packages/ghostscript.scm, gnu/packages/gl.scm, gnu/packages/glib.scm, gnu/packages/gnome.scm, gnu/packages/gnuzilla.scm, gnu/packages/graphics.scm, gnu/packages/gtk.scm, gnu/packages/guile.scm, gnu/packages/irc.scm, gnu/packages/java.scm, gnu/packages/kerberos.scm, gnu/packages/linux.scm, gnu/packages/lisp.scm, gnu/packages/lxde.scm, gnu/packages/machine-learning.scm, gnu/packages/mail.scm, gnu/packages/maths.scm, gnu/packages/messaging.scm, gnu/packages/monitoring.scm, gnu/packages/mp3.scm, gnu/packages/music.scm, gnu/packages/netpbm.scm, gnu/packages/networking.scm, gnu/packages/node.scm, gnu/packages/nvi.scm, gnu/packages/ocaml.scm, gnu/packages/pdf.scm, gnu/packages/perl.scm, gnu/packages/php.scm, gnu/packages/plotutils.scm, gnu/packages/pretty-print.scm, gnu/packages/profiling.scm, gnu/packages/pulseaudio.scm, gnu/packages/python-crypto.scm, gnu/packages/python.scm, gnu/packages/qt.scm, gnu/packages/robotics.scm, gnu/packages/sawfish.scm, gnu/packages/scanner.scm, gnu/packages/scheme.scm, gnu/packages/scribus.scm, gnu/packages/sdl.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/slang.scm, gnu/packages/smalltalk.scm, gnu/packages/ssh.scm, gnu/packages/sync.scm, gnu/packages/syncthing.scm, gnu/packages/tbb.scm, gnu/packages/terminals.scm, gnu/packages/texinfo.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/tls.scm, gnu/packages/unrtf.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vpn.scm, gnu/packages/web.scm, gnu/packages/wm.scm, gnu/packages/wxwidgets.scm, gnu/packages/xdisorg.scm, gnu/packages/xorg.scm: In all snippets, report errors using exceptions, or else return #t. Mark H Weaver 2018-02-23gnu: dolphin-emu: Enable Vulkan video backend....* gnu/packages/emulators.scm (dolphin-emu): Enable Vulkan video backend. [inputs]: Add vulkan-icd-loader. [arguments]: Rename 'generate-fonts to 'generate-fonts&hardcore-libvulkan-path. Hardcode libvulkan.so. Rutger Helling 2018-02-22gnu: dolphin-emu: Shorten the source snippet....* gnu/packages/emulators.scm (dolphin-emu): Rewrite the source snippet to be more compact. Efraim Flashner 2018-02-22gnu: dolphin-emu: Enable building on aarch64-linux....* gnu/packages/emulators.scm (dolphin-emu)[supported-systems]: Add aarch64-linux. Efraim Flashner 2018-02-22gnu: Move emulation packages from games to emulators....* gnu/packages/games.scm (desmume) (dosbox) (emulation-station) (higan) (mgba) (mupen64plus-audio-sdl) (mupen64plus-core) (mupen64plus-input-sdl) (mupen64plus-rsp-hle) (mupen64plus-rsp-z64) (mupen64plus-ui-console) (mupen64plus-video-arachnoid) (mupen64plus-video-glide64) (mupen64plus-video-glide64mk2) (mupen64plus-video-rice) (mupen64plus-video-z64) (nestopia-ue) (retroarch): Move to... * gnu/packages/emulators.scm: ... here. Rutger Helling 2018-02-22gnu: Add dolphin-emu....* gnu/packages/emulators.scm (dolphin-emu): New variable. Rutger Helling