Skip to content

Instantly share code, notes, and snippets.

@bildeyko
Created October 13, 2016 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bildeyko/263b12ab845288b33537bf344e8e9c56 to your computer and use it in GitHub Desktop.
Save bildeyko/263b12ab845288b33537bf344e8e9c56 to your computer and use it in GitHub Desktop.
`timescale 1ns / 1ps
module demux1to4(
input Data_i,
input[1:0] sel,
output reg Data_1_o,
output reg Data_2_o,
output reg Data_3_o
);
always @(Data_i or sel)
begin
case (sel)
2'b00 : begin
Data_1_o = 0;
Data_2_o = 0;
Data_3_o = 0;
end
2'b01 : begin
$display("01");
Data_1_o = Data_i;
Data_2_o = 0;
Data_3_o = 0;
end
2'b10 : begin
$display("10");
Data_1_o = 0;
Data_2_o = Data_i;
Data_3_o = 0;
end
2'b11 : begin
$display("11");
Data_1_o = 0;
Data_2_o = 0;
Data_3_o = Data_i;
end
endcase
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment