添加了数码管模块

main
阳光少年 8 months ago
parent 97f0eb7b83
commit d5cb5c11f4

@ -2,11 +2,14 @@
// 7 8 9 10 11 12 6 5 4 3 2 1 // 7 8 9 10 11 12 6 5 4 3 2 1
// B S3 S2 F A S1 S4 G C DP D E // B S3 S2 F A S1 S4 G C DP D E
module dt( module dt(
input wire [7:0]data, // en: 1, select:2, dp: 1, data: 4 // input wire [7:0]data, // en: 1, select:2, dp: 1, data: 4
output reg A, B, C, D, E, F, G, DP, output wire A, B, C, D, E, F, G, DP,
output reg S1, S2, S3, S4 output wire S1, S2, S3, S4
); );
wire [7:0]data;
assign data = 8'b1000_0010;
parameter _SELECT_1 = 4'b1110; parameter _SELECT_1 = 4'b1110;
parameter _SELECT_2 = 4'b1101; parameter _SELECT_2 = 4'b1101;
parameter _SELECT_3 = 4'b1011; parameter _SELECT_3 = 4'b1011;
@ -15,7 +18,8 @@ parameter _SELECT_4 = 4'b0111;
parameter SELECTOR = {_SELECT_4, _SELECT_3, _SELECT_2, _SELECT_1}; parameter SELECTOR = {_SELECT_4, _SELECT_3, _SELECT_2, _SELECT_1};
// ABCD_EFGP // ABCD_EFGP
parameter _SHOW_0 = 8'B1111_1110;
parameter _SHOW_1 = 8'B0110_0000; parameter _SHOW_1 = 8'B0110_0000;
parameter _SHOW_2 = 8'B1101_1010; parameter _SHOW_2 = 8'B1101_1010;
parameter _SHOW_3 = 8'B1111_0010; parameter _SHOW_3 = 8'B1111_0010;
@ -25,7 +29,6 @@ parameter _SHOW_6 = 8'B1111_1110;
parameter _SHOW_7 = 8'B1111_1110; parameter _SHOW_7 = 8'B1111_1110;
parameter _SHOW_8 = 8'B1111_1110; parameter _SHOW_8 = 8'B1111_1110;
parameter _SHOW_9 = 8'B1111_1110; parameter _SHOW_9 = 8'B1111_1110;
parameter _SHOW_0 = 8'B1111_1110;
parameter _SHOW_A = 8'B1111_1110; parameter _SHOW_A = 8'B1111_1110;
parameter _SHOW_B = 8'B1111_1110; parameter _SHOW_B = 8'B1111_1110;
parameter _SHOW_C = 8'B1111_1110; parameter _SHOW_C = 8'B1111_1110;
@ -36,11 +39,13 @@ parameter _SHOW_F = 8'B1111_1110;
parameter SHOW = {_SHOW_F, _SHOW_E, _SHOW_D, _SHOW_C, _SHOW_B, _SHOW_A, _SHOW_9, _SHOW_8, _SHOW_7, _SHOW_6, _SHOW_5, _SHOW_4, _SHOW_3, _SHOW_2, _SHOW_1, _SHOW_0}; parameter SHOW = {_SHOW_F, _SHOW_E, _SHOW_D, _SHOW_C, _SHOW_B, _SHOW_A, _SHOW_9, _SHOW_8, _SHOW_7, _SHOW_6, _SHOW_5, _SHOW_4, _SHOW_3, _SHOW_2, _SHOW_1, _SHOW_0};
always @(data) begin // always @(data) begin
if (!data[7]) // if (data[7]) begin
{S4, S3, S2, S1} = 4'b1111; // {S4, S3, S2, S1} = SELECTOR >> (data[6:5] << 2);
else // {A, B, C, D, E, F, G, DP} = {SHOW >> (data[3:0] << 3) >> 1, data[4]};
{S4, S3, S2, S1} = SELECTOR >> (data[6:5] << 2); // end
{A, B, C, D, E, F, G, DP} = {SHOW >> (data[3:0] << 3) >> 1, data[4]}; // end
end
assign {S4, S3, S2, S1} = 4'b0110;
assign {A, B, C, D, E, F, G, DP} = _SHOW_2;
endmodule endmodule

@ -91,6 +91,23 @@ wire [16:0] Slice;
// //
// !! {A[0], 5} 5 32 // !! {A[0], 5} 5 32
// , 使沿沿,
wire my_s;
always @(posedge my_s) begin // 使
end
//
// , 使,
// a_1 1, b_10, a_1b_1, c_1, 2, , ,线 c_1
reg a_1,b_1,c_1;
always @(*) begin
b_1 <= a_1;
c_1 <= b_1 + a_1;
end
endmodule endmodule

@ -7,100 +7,124 @@
:vpi_module "C:\iverilog\lib\ivl\vhdl_textio.vpi"; :vpi_module "C:\iverilog\lib\ivl\vhdl_textio.vpi";
:vpi_module "C:\iverilog\lib\ivl\v2005_math.vpi"; :vpi_module "C:\iverilog\lib\ivl\v2005_math.vpi";
:vpi_module "C:\iverilog\lib\ivl\va_math.vpi"; :vpi_module "C:\iverilog\lib\ivl\va_math.vpi";
S_0000026063717710 .scope module, "led" "led" 2 1; S_000002a9cf0c0950 .scope module, "led" "led" 2 1;
.timescale 0 0; .timescale 0 0;
.port_info 0 /INPUT 1 "key"; .port_info 0 /INPUT 1 "key";
.port_info 1 /OUTPUT 1 "led"; .port_info 1 /OUTPUT 1 "led";
P_000002606380a730 .param/l "WIDTH" 0 2 6, +C4<00000000000000000000000000000101>; P_000002a9cee86dc0 .param/l "WIDTH" 0 2 6, +C4<00000000000000000000000000000101>;
o000002606372d498 .functor BUFZ 1, C4<z>; HiZ drive P_000002a9cee86df8 .param/l "w_1" 0 2 31, C4<0100>;
L_0000026063726ff0 .functor BUFZ 1, o000002606372d498, C4<0>, C4<0>, C4<0>; o000002a9cf0cd608 .functor BUFZ 1, C4<z>; HiZ drive
L_00000260637275a0 .functor AND 1, L_00000260637223f0, L_0000026063722210, C4<1>, C4<1>; L_000002a9cf0bf320 .functor BUFZ 1, o000002a9cf0cd608, C4<0>, C4<0>, C4<0>;
o000002606372cf58 .functor BUFZ 5, C4<zzzzz>; HiZ drive L_000002a9cf0bf7f0 .functor AND 1, L_000002a9cf1227a0, L_000002a9cf1213a0, C4<1>, C4<1>;
L_0000026063727060 .functor AND 5, o000002606372cf58, L_00000260637222b0, C4<11111>, C4<11111>; o000002a9cf0cd038 .functor BUFZ 5, C4<zzzzz>; HiZ drive
v0000026063718850_0 .net "U", 4 0, L_0000026063727060; 1 drivers L_000002a9cf0bf240 .functor AND 5, o000002a9cf0cd038, L_000002a9cf121620, C4<11111>, C4<11111>;
v0000026063718710_0 .net "V", 4 0, L_00000260637222b0; 1 drivers v000002a9cf0ba590_0 .net "U", 4 0, L_000002a9cf0bf240; 1 drivers
v00000260637191b0_0 .net "W", 4 0, o000002606372cf58; 0 drivers v000002a9cf0ba450_0 .net "V", 4 0, L_000002a9cf121620; 1 drivers
L_000002606377e1c8 .functor BUFT 1, C4<00110>, C4<0>, C4<0>, C4<0>; v000002a9cf0b9e10_0 .net "W", 4 0, o000002a9cf0cd038; 0 drivers
v0000026063719390_0 .net "Y1", 4 0, L_000002606377e1c8; 1 drivers L_000002a9cf122ec8 .functor BUFT 1, C4<00110>, C4<0>, C4<0>, C4<0>;
v0000026063718ad0_0 .net "Y2", 4 0, L_0000026063723a70; 1 drivers v000002a9cf0ba4f0_0 .net "Y1", 4 0, L_000002a9cf122ec8; 1 drivers
L_000002606377e258 .functor BUFT 1, C4<01>, C4<0>, C4<0>, C4<0>; v000002a9cf0ba950_0 .net "Y2", 4 0, L_000002a9cf121a80; 1 drivers
v0000026063718990_0 .net *"_ivl_21", 1 0, L_000002606377e258; 1 drivers L_000002a9cf122f58 .functor BUFT 1, C4<01>, C4<0>, C4<0>, C4<0>;
L_000002606377e2a0 .functor BUFT 1, C4<01>, C4<0>, C4<0>, C4<0>; v000002a9cf0ba630_0 .net *"_ivl_21", 1 0, L_000002a9cf122f58; 1 drivers
v0000026063718a30_0 .net *"_ivl_25", 1 0, L_000002606377e2a0; 1 drivers L_000002a9cf122fa0 .functor BUFT 1, C4<01>, C4<0>, C4<0>, C4<0>;
v0000026063718c10_0 .net *"_ivl_29", 1 0, L_0000026063723750; 1 drivers v000002a9cf0ba6d0_0 .net *"_ivl_25", 1 0, L_000002a9cf122fa0; 1 drivers
v0000026063718cb0_0 .net *"_ivl_3", 0 0, L_0000026063726ff0; 1 drivers v000002a9cf0ba770_0 .net *"_ivl_29", 1 0, L_000002a9cf120d60; 1 drivers
v0000026063718df0_0 .net *"_ivl_31", 0 0, L_00000260637239d0; 1 drivers v000002a9cf0b9eb0_0 .net *"_ivl_3", 0 0, L_000002a9cf0bf320; 1 drivers
v0000026063718fd0_0 .net *"_ivl_33", 0 0, L_0000026063722df0; 1 drivers v000002a9cf0b9f50_0 .net *"_ivl_31", 0 0, L_000002a9cf121b20; 1 drivers
L_000002606377e2e8 .functor BUFT 1, C4<01>, C4<0>, C4<0>, C4<0>; v000002a9cf0ba9f0_0 .net *"_ivl_33", 0 0, L_000002a9cf121bc0; 1 drivers
v0000026063718e90_0 .net *"_ivl_39", 1 0, L_000002606377e2e8; 1 drivers L_000002a9cf122fe8 .functor BUFT 1, C4<01>, C4<0>, C4<0>, C4<0>;
L_000002606377e330 .functor BUFT 1, C4<01>, C4<0>, C4<0>, C4<0>; v000002a9cf121300_0 .net *"_ivl_39", 1 0, L_000002a9cf122fe8; 1 drivers
v0000026063719250_0 .net *"_ivl_43", 1 0, L_000002606377e330; 1 drivers L_000002a9cf123030 .functor BUFT 1, C4<01>, C4<0>, C4<0>, C4<0>;
v0000026063723430_0 .net *"_ivl_47", 1 0, L_0000026063722170; 1 drivers v000002a9cf122660_0 .net *"_ivl_43", 1 0, L_000002a9cf123030; 1 drivers
L_000002606377e0f0 .functor BUFT 1, C4<000>, C4<0>, C4<0>, C4<0>; v000002a9cf1223e0_0 .net *"_ivl_47", 1 0, L_000002a9cf122020; 1 drivers
v0000026063723c50_0 .net/2u *"_ivl_49", 2 0, L_000002606377e0f0; 1 drivers L_000002a9cf122df0 .functor BUFT 1, C4<000>, C4<0>, C4<0>, C4<0>;
v00000260637231b0_0 .net *"_ivl_51", 0 0, L_00000260637223f0; 1 drivers v000002a9cf1214e0_0 .net/2u *"_ivl_49", 2 0, L_000002a9cf122df0; 1 drivers
L_000002606377e138 .functor BUFT 1, C4<000>, C4<0>, C4<0>, C4<0>; v000002a9cf120fe0_0 .net *"_ivl_51", 0 0, L_000002a9cf1227a0; 1 drivers
v0000026063722710_0 .net/2u *"_ivl_53", 2 0, L_000002606377e138; 1 drivers L_000002a9cf122e38 .functor BUFT 1, C4<000>, C4<0>, C4<0>, C4<0>;
v0000026063723890_0 .net *"_ivl_55", 0 0, L_0000026063722210; 1 drivers v000002a9cf121760_0 .net/2u *"_ivl_53", 2 0, L_000002a9cf122e38; 1 drivers
v0000026063723bb0_0 .net *"_ivl_60", 0 0, L_0000026063722990; 1 drivers v000002a9cf121260_0 .net *"_ivl_55", 0 0, L_000002a9cf1213a0; 1 drivers
L_000002606377e180 .functor BUFT 1, C4<0000>, C4<0>, C4<0>, C4<0>; v000002a9cf122480_0 .net *"_ivl_60", 0 0, L_000002a9cf121440; 1 drivers
v0000026063722490_0 .net *"_ivl_64", 3 0, L_000002606377e180; 1 drivers L_000002a9cf122e80 .functor BUFT 1, C4<0000>, C4<0>, C4<0>, C4<0>;
v0000026063723cf0_0 .net *"_ivl_7", 0 0, L_0000026063723610; 1 drivers v000002a9cf121ee0_0 .net *"_ivl_64", 3 0, L_000002a9cf122e80; 1 drivers
v0000026063723d90_0 .net *"_ivl_71", 2 0, L_0000026063723110; 1 drivers v000002a9cf122340_0 .net *"_ivl_7", 0 0, L_000002a9cf121800; 1 drivers
L_000002606377e210 .functor BUFT 1, C4<00>, C4<0>, C4<0>, C4<0>; v000002a9cf122980_0 .net *"_ivl_71", 2 0, L_000002a9cf1216c0; 1 drivers
v0000026063722b70_0 .net *"_ivl_73", 1 0, L_000002606377e210; 1 drivers L_000002a9cf122f10 .functor BUFT 1, C4<00>, C4<0>, C4<0>, C4<0>;
o000002606372d348 .functor BUFZ 4, C4<zzzz>; HiZ drive v000002a9cf122ac0_0 .net *"_ivl_73", 1 0, L_000002a9cf122f10; 1 drivers
; Elide local net with no drivers, v0000026063722850_0 name=_ivl_79 o000002a9cf0cd428 .functor BUFZ 4, C4<zzzz>; HiZ drive
L_000002606377e060 .functor BUFT 1, C4<1>, C4<0>, C4<0>, C4<0>; ; Elide local net with no drivers, v000002a9cf121f80_0 name=_ivl_83
v0000026063722ad0_0 .net "a", 0 0, L_000002606377e060; 1 drivers L_000002a9cf122d60 .functor BUFT 1, C4<1>, C4<0>, C4<0>, C4<0>;
L_000002606377e0a8 .functor BUFT 1, C4<1>, C4<0>, C4<0>, C4<0>; v000002a9cf121c60_0 .net "a", 0 0, L_000002a9cf122d60; 1 drivers
v0000026063723930_0 .net "b", 0 0, L_000002606377e0a8; 1 drivers v000002a9cf121120_0 .var "a_1", 0 0;
L_000002606377df88 .functor BUFT 1, C4<0>, C4<0>, C4<0>, C4<0>; L_000002a9cf122da8 .functor BUFT 1, C4<1>, C4<0>, C4<0>, C4<0>;
v00000260637232f0_0 .net "c", 0 0, L_000002606377df88; 1 drivers v000002a9cf121d00_0 .net "b", 0 0, L_000002a9cf122da8; 1 drivers
v0000026063721f90_0 .net "d", 0 0, L_00000260637236b0; 1 drivers v000002a9cf1220c0_0 .var "b_1", 0 0;
L_000002606377dfd0 .functor BUFT 1, C4<0>, C4<0>, C4<0>, C4<0>; L_000002a9cf122c88 .functor BUFT 1, C4<0>, C4<0>, C4<0>, C4<0>;
v0000026063722c10_0 .net "f", 0 0, L_000002606377dfd0; 1 drivers v000002a9cf1225c0_0 .net "c", 0 0, L_000002a9cf122c88; 1 drivers
L_000002606377e018 .functor BUFT 1, C4<010>, C4<0>, C4<0>, C4<0>; v000002a9cf122b60_0 .var "c_1", 0 0;
v0000026063722030_0 .net "g", 2 0, L_000002606377e018; 1 drivers v000002a9cf1222a0_0 .net "d", 0 0, L_000002a9cf121da0; 1 drivers
v00000260637237f0_0 .net "key", 0 0, o000002606372d498; 0 drivers L_000002a9cf122cd0 .functor BUFT 1, C4<0>, C4<0>, C4<0>, C4<0>;
o000002606372d4c8 .functor BUFZ 3, C4<zzz>; HiZ drive v000002a9cf1211c0_0 .net "f", 0 0, L_000002a9cf122cd0; 1 drivers
v0000026063723390_0 .net "l_a", 2 0, o000002606372d4c8; 0 drivers L_000002a9cf122d18 .functor BUFT 1, C4<010>, C4<0>, C4<0>, C4<0>;
o000002606372d4f8 .functor BUFZ 3, C4<zzz>; HiZ drive v000002a9cf121580_0 .net "g", 2 0, L_000002a9cf122d18; 1 drivers
v00000260637220d0_0 .net "l_b", 2 0, o000002606372d4f8; 0 drivers v000002a9cf120ea0_0 .net "key", 0 0, o000002a9cf0cd608; 0 drivers
v0000026063722530_0 .net "l_c", 0 0, L_00000260637275a0; 1 drivers o000002a9cf0cd638 .functor BUFZ 3, C4<zzz>; HiZ drive
v0000026063722e90_0 .var "led", 0 0; v000002a9cf122520_0 .net "l_a", 2 0, o000002a9cf0cd638; 0 drivers
v0000026063722f30_0 .net "ret", 1 0, L_0000026063723070; 1 drivers o000002a9cf0cd668 .functor BUFZ 3, C4<zzz>; HiZ drive
v00000260637234d0_0 .net "s", 0 0, L_00000260637225d0; 1 drivers v000002a9cf122160_0 .net "l_b", 2 0, o000002a9cf0cd668; 0 drivers
v0000026063723570_0 .var "v_reg", 5 0; v000002a9cf122a20_0 .net "l_c", 0 0, L_000002a9cf0bf7f0; 1 drivers
v0000026063721ef0_0 .net "v_wire", 5 0, L_0000026063723b10; 1 drivers v000002a9cf121080_0 .var "led", 0 0;
E_000002606380a4b0 .event anyedge, v00000260637237f0_0; o000002a9cf0cd6f8 .functor BUFZ 1, C4<z>; HiZ drive
L_0000026063723610 .part v0000026063723570_0, 1, 1; v000002a9cf122840_0 .net "my_s", 0 0, o000002a9cf0cd6f8; 0 drivers
L_00000260637225d0 .part L_0000026063723750, 1, 1; v000002a9cf120e00_0 .net "ret", 1 0, L_000002a9cf120f40; 1 drivers
L_00000260637236b0 .part L_0000026063723750, 0, 1; v000002a9cf122200_0 .net "s", 0 0, L_000002a9cf1228e0; 1 drivers
L_0000026063723750 .arith/sum 2, L_000002606377e258, L_000002606377e2a0; v000002a9cf120cc0_0 .var "v_reg", 5 0;
L_0000026063723070 .concat8 [ 1 1 0 0], L_0000026063722df0, L_00000260637239d0; v000002a9cf122700_0 .net "v_wire", 5 0, L_000002a9cf1218a0; 1 drivers
L_00000260637239d0 .part L_0000026063722170, 1, 1; E_000002a9cf0bb410 .event anyedge, v000002a9cf121120_0, v000002a9cf1220c0_0;
L_0000026063722df0 .part L_0000026063722170, 0, 1; E_000002a9cf0baf50 .event posedge, v000002a9cf122840_0;
L_0000026063722170 .arith/sum 2, L_000002606377e2e8, L_000002606377e330; E_000002a9cf0bb210 .event anyedge, v000002a9cf120ea0_0;
L_00000260637223f0 .cmp/ne 3, o000002606372d4c8, L_000002606377e0f0; L_000002a9cf121800 .part v000002a9cf120cc0_0, 1, 1;
L_0000026063722210 .cmp/ne 3, o000002606372d4f8, L_000002606377e138; L_000002a9cf1228e0 .part L_000002a9cf120d60, 1, 1;
L_0000026063722990 .reduce/and o000002606372cf58; L_000002a9cf121da0 .part L_000002a9cf120d60, 0, 1;
L_00000260637222b0 .concat [ 1 4 0 0], L_0000026063722990, L_000002606377e180; L_000002a9cf120d60 .arith/sum 2, L_000002a9cf122f58, L_000002a9cf122fa0;
L_0000026063723110 .part L_000002606377e1c8, 0, 3; L_000002a9cf120f40 .concat8 [ 1 1 0 0], L_000002a9cf121bc0, L_000002a9cf121b20;
L_0000026063723a70 .concat [ 2 3 0 0], L_000002606377e210, L_0000026063723110; L_000002a9cf121b20 .part L_000002a9cf122020, 1, 1;
L_0000026063723b10 .concat [ 1 1 4 0], L_0000026063726ff0, L_0000026063723610, o000002606372d348; L_000002a9cf121bc0 .part L_000002a9cf122020, 0, 1;
.scope S_0000026063717710; L_000002a9cf122020 .arith/sum 2, L_000002a9cf122fe8, L_000002a9cf123030;
L_000002a9cf1227a0 .cmp/ne 3, o000002a9cf0cd638, L_000002a9cf122df0;
L_000002a9cf1213a0 .cmp/ne 3, o000002a9cf0cd668, L_000002a9cf122e38;
L_000002a9cf121440 .reduce/and o000002a9cf0cd038;
L_000002a9cf121620 .concat [ 1 4 0 0], L_000002a9cf121440, L_000002a9cf122e80;
L_000002a9cf1216c0 .part L_000002a9cf122ec8, 0, 3;
L_000002a9cf121a80 .concat [ 2 3 0 0], L_000002a9cf122f10, L_000002a9cf1216c0;
L_000002a9cf1218a0 .concat [ 1 1 4 0], L_000002a9cf0bf320, L_000002a9cf121800, o000002a9cf0cd428;
.scope S_000002a9cf0c0950;
T_0 ; T_0 ;
%wait E_000002606380a4b0; %wait E_000002a9cf0bb210;
%load/vec4 v00000260637237f0_0; %load/vec4 v000002a9cf120ea0_0;
%nor/r; %nor/r;
%store/vec4 v0000026063722e90_0, 0, 1; %store/vec4 v000002a9cf121080_0, 0, 1;
%load/vec4 v00000260637237f0_0; %load/vec4 v000002a9cf120ea0_0;
%ix/load 4, 1, 0; %ix/load 4, 1, 0;
%flag_set/imm 4, 0; %flag_set/imm 4, 0;
%store/vec4 v0000026063723570_0, 4, 1; %store/vec4 v000002a9cf120cc0_0, 4, 1;
%jmp T_0; %jmp T_0;
.thread T_0, $push; .thread T_0, $push;
.scope S_000002a9cf0c0950;
T_1 ;
%wait E_000002a9cf0baf50;
%jmp T_1;
.thread T_1;
.scope S_000002a9cf0c0950;
T_2 ;
%wait E_000002a9cf0bb410;
%load/vec4 v000002a9cf121120_0;
%assign/vec4 v000002a9cf1220c0_0, 0;
%load/vec4 v000002a9cf1220c0_0;
%load/vec4 v000002a9cf121120_0;
%add;
%assign/vec4 v000002a9cf122b60_0, 0;
%jmp T_2;
.thread T_2, $push;
# The file index is used to find the file name in the following table. # The file index is used to find the file name in the following table.
:file_names 3; :file_names 3;
"N/A"; "N/A";

@ -1,27 +1,27 @@
module td_led (); module tb_led ();
`timescale 1ns/1ns // / `timescale 1ns/1ns // /
reg td_key; // ( initial , 使) reg tb_key; // ( initial , 使)
wire td_led; // , 使 wire wire tb_led; // , 使 wire
// //
initial begin initial begin
td_key <= 1'b1; // tb_key <= 1'b1; //
#200; // 200ns #200; // 200ns
td_key <= 1'b0; tb_key <= 1'b0;
#500; #500;
td_key <= 1'b1; tb_key <= 1'b1;
#1000; #1000;
td_key <= 1'b0; tb_key <= 1'b0;
end end
// , // ,
led u_led( led u_led(
.key (td_key), .key (tb_key),
.led (td_led) // wire, led, reg, , alaways, 使 wire .led (tb_led) // wire, led, reg, , alaways, 使 wire
// .xx () // , , // .xx () // , ,
); );

Loading…
Cancel
Save