File tree Expand file tree Collapse file tree 3 files changed +75
-39
lines changed Expand file tree Collapse file tree 3 files changed +75
-39
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // src/mux2.veryl
2+
3+ module Mux2 #(
4+ param Width: u32 = 32,
5+ ) (
6+ i_data: input logic<Width> [2],
7+ i_sel : input logic ,
8+ o_data: output logic<Width> ,
9+ ) {
10+ assign o_data = i_data[i_sel];
11+ }
12+
13+ #[test(mux2)]
14+ embed (inline) sv{{{
15+ module test;
16+ logic [31:0] i_data [2];
17+ logic i_sel;
18+ logic [31:0] o_data;
19+ vips_Mux2 Mux2 (i_data, i_sel, o_data);
20+
21+ initial begin
22+ i_data = {1,2};
23+ i_sel = 0;
24+ #10;
25+ assert (o_data == 1) else $error("0->1");
26+
27+ i_sel = 1;
28+ #10;
29+ assert (o_data == 2) else $error("1->2");
30+
31+ $finish;
32+ end
33+ endmodule
34+ }}}
Original file line number Diff line number Diff line change 1+ // src/mux4.veryl
2+
3+ module Mux4 #(
4+ param Width: u32 = 32,
5+ ) (
6+ i_data: input logic<Width> [4],
7+ i_s : input logic<2> ,
8+ o_data: output logic<Width> ,
9+ ) {
10+ assign o_data = i_data[i_s];
11+ }
12+
13+ #[test(mux4)]
14+ embed (inline) sv{{{
15+ module test;
16+ logic [31:0] i_data [4];
17+ logic [1:0] i_sel;
18+ logic [31:0] o_data;
19+ vips_Mux4 Mux4 (i_data, i_sel, o_data);
20+
21+ initial begin
22+ i_data = {1,2,3,4};
23+ i_sel = 0;
24+ #10;
25+ assert (o_data == 1) else $error("0->1");
26+
27+ i_sel = 1;
28+ #10;
29+ assert (o_data == 2) else $error("1->2");
30+
31+ i_sel = 2;
32+ #10;
33+ assert (o_data == 3) else $error("2->3");
34+
35+ i_sel = 3;
36+ #10;
37+ assert (o_data == 4) else $error("3->4");
38+ $finish;
39+ end
40+ endmodule
41+ }}}
You can’t perform that action at this time.
0 commit comments