VL1 四选一多路选择器
module mux4_1(
    input [1:0] d1,d2,d3,d0,
    input [1:0] sel,
    output [1:0] mux_out);
    reg [1:0] mux_out_tmp;


    always@ (*)begin
    case(sel)
       2'b00 :mux_out_tmp = d3;
       2'b01 :mux_out_tmp = d2;
       2'b10 :mux_out_tmp = d1;
       2'b11 :mux_out_tmp = d0;
        default:mux_out_tmp = d3;
    endcase
module mux4_1(
input    [1:0]    d1,d2,d3,d0,
input    [1:0]    sel,
output   [1:0]    mux_out
);

assign mux_out  = sel[0]?(sel[1]?d0:d2):(sel[1]?d1:d3);   // 先判断高位,后判断低位,
//assign mux_out = sel[1]?(sel[0]?d0:d1):(sel[0]?d2:d3);  // 先判断低位,后判断高位,
endmodule
module mux4_1(
input [1:0]d1,d2,d3,d0,
input [1:0]sel,
output[1:0]mux_out
);
//*************code***********//
    assign mux_out = (sel==2'b00) ? d3 : (sel==2'b01) ? d2 : (sel==2'b10) ? d1 : (sel==2'b11) ? d0 : 2'b00;
//*************code***********//
endmodule
VL2 异步复位的串联T触发器
module Tff_2 (
input wire data, clk, rst,
output reg q  
);
//*************code***********//
    reg data_1;
    always @ ( posedge clk or negedge rst) begin 
        if (!rst) 
        data_1 <= 1'b0;
        else
         data_1 <= data^data_1;
end