Skip to content

Commit c03dbce

Browse files
committed
如果採用,此提交將完成6-3範例與習題
修改項目: 模組: 議題61
1 parent 914a551 commit c03dbce

7 files changed

Lines changed: 494 additions & 7 deletions

File tree

VerilogHDL_Practice/CH6/CH6-3/max/max.xpr

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<Option Name="IPUserFilesDir" Val="$PIPUSERFILESDIR"/>
3838
<Option Name="IPStaticSourceDir" Val="$PIPUSERFILESDIR/ipstatic"/>
3939
<Option Name="EnableBDX" Val="FALSE"/>
40-
<Option Name="WTXSimLaunchSim" Val="1"/>
40+
<Option Name="WTXSimLaunchSim" Val="2"/>
4141
<Option Name="WTModelSimLaunchSim" Val="0"/>
4242
<Option Name="WTQuestaLaunchSim" Val="0"/>
4343
<Option Name="WTIesLaunchSim" Val="0"/>
@@ -86,6 +86,7 @@
8686
</Config>
8787
</FileSet>
8888
<FileSet Name="sim_1" Type="SimulationSrcs" RelSrcDir="$PSRCDIR/sim_1">
89+
<Filter Type="Srcs"/>
8990
<File Path="$PPRDIR/../max_test.v">
9091
<FileInfo>
9192
<Attr Name="UsedIn" Val="synthesis"/>
@@ -142,9 +143,7 @@
142143
<Runs Version="1" Minor="11">
143144
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_1" IncludeInArchive="true">
144145
<Strategy Version="1" Minor="2">
145-
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2020">
146-
<Desc>Vivado Synthesis Defaults</Desc>
147-
</StratHandle>
146+
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2020"/>
148147
<Step Id="synth_design"/>
149148
</Strategy>
150149
<GeneratedRun Dir="$PRUNDIR" File="gen_run.xml"/>
@@ -154,9 +153,7 @@
154153
</Run>
155154
<Run Id="impl_1" Type="Ft2:EntireDesign" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Default settings for Implementation." AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/impl_1" SynthRun="synth_1" IncludeInArchive="true" GenFullBitstream="true">
156155
<Strategy Version="1" Minor="2">
157-
<StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2020">
158-
<Desc>Default settings for Implementation.</Desc>
159-
</StratHandle>
156+
<StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2020"/>
160157
<Step Id="init_design"/>
161158
<Step Id="opt_design"/>
162159
<Step Id="power_opt_design"/>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module mid (A, B, C, Z);
2+
input [3:0] A, B, C;
3+
output [3:0] Z;
4+
reg [3:0] Z;
5+
6+
always @ (A or B or C) begin
7+
if (A > B & B < C | A < B & B < C) begin
8+
Z = B;
9+
end else if (A > C & C > B | A < C & C < B) begin
10+
Z = C;
11+
end else if (C > A & A > B | C < A & A < B) begin
12+
Z = A;
13+
end else if (C == A & B == A) begin
14+
Z = A;
15+
end
16+
17+
end
18+
19+
endmodule // mid
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Product Version: Vivado v2020.1 (64-bit) -->
3+
<!-- -->
4+
<!-- Copyright 1986-2020 Xilinx, Inc. All Rights Reserved. -->
5+
6+
<Project Version="7" Minor="49" Path="/home/timmy/Git/Digital-Logic-Design/VerilogHDL_Practice/CH6/CH6-3/mid/mid.xpr">
7+
<DefaultLaunch Dir="$PRUNDIR"/>
8+
<Configuration>
9+
<Option Name="Id" Val="ee1a473fc62d4d3f881e1221ead50d9e"/>
10+
<Option Name="Part" Val="xc7a35tcsg324-1"/>
11+
<Option Name="CompiledLibDir" Val="$PCACHEDIR/compile_simlib"/>
12+
<Option Name="CompiledLibDirXSim" Val=""/>
13+
<Option Name="CompiledLibDirModelSim" Val="$PCACHEDIR/compile_simlib/modelsim"/>
14+
<Option Name="CompiledLibDirQuesta" Val="$PCACHEDIR/compile_simlib/questa"/>
15+
<Option Name="CompiledLibDirIES" Val="$PCACHEDIR/compile_simlib/ies"/>
16+
<Option Name="CompiledLibDirXcelium" Val="$PCACHEDIR/compile_simlib/xcelium"/>
17+
<Option Name="CompiledLibDirVCS" Val="$PCACHEDIR/compile_simlib/vcs"/>
18+
<Option Name="CompiledLibDirRiviera" Val="$PCACHEDIR/compile_simlib/riviera"/>
19+
<Option Name="CompiledLibDirActivehdl" Val="$PCACHEDIR/compile_simlib/activehdl"/>
20+
<Option Name="SimulatorInstallDirModelSim" Val=""/>
21+
<Option Name="SimulatorInstallDirQuesta" Val=""/>
22+
<Option Name="SimulatorInstallDirIES" Val=""/>
23+
<Option Name="SimulatorInstallDirXcelium" Val=""/>
24+
<Option Name="SimulatorInstallDirVCS" Val=""/>
25+
<Option Name="SimulatorInstallDirRiviera" Val=""/>
26+
<Option Name="SimulatorInstallDirActiveHdl" Val=""/>
27+
<Option Name="BoardPart" Val=""/>
28+
<Option Name="ActiveSimSet" Val="sim_1"/>
29+
<Option Name="DefaultLib" Val="xil_defaultlib"/>
30+
<Option Name="ProjectType" Val="Default"/>
31+
<Option Name="IPOutputRepo" Val="$PCACHEDIR/ip"/>
32+
<Option Name="IPDefaultOutputPath" Val="$PSRCDIR/sources_1"/>
33+
<Option Name="IPCachePermission" Val="read"/>
34+
<Option Name="IPCachePermission" Val="write"/>
35+
<Option Name="EnableCoreContainer" Val="FALSE"/>
36+
<Option Name="CreateRefXciForCoreContainers" Val="FALSE"/>
37+
<Option Name="IPUserFilesDir" Val="$PIPUSERFILESDIR"/>
38+
<Option Name="IPStaticSourceDir" Val="$PIPUSERFILESDIR/ipstatic"/>
39+
<Option Name="EnableBDX" Val="FALSE"/>
40+
<Option Name="WTXSimLaunchSim" Val="4"/>
41+
<Option Name="WTModelSimLaunchSim" Val="0"/>
42+
<Option Name="WTQuestaLaunchSim" Val="0"/>
43+
<Option Name="WTIesLaunchSim" Val="0"/>
44+
<Option Name="WTVcsLaunchSim" Val="0"/>
45+
<Option Name="WTRivieraLaunchSim" Val="0"/>
46+
<Option Name="WTActivehdlLaunchSim" Val="0"/>
47+
<Option Name="WTXSimExportSim" Val="0"/>
48+
<Option Name="WTModelSimExportSim" Val="0"/>
49+
<Option Name="WTQuestaExportSim" Val="0"/>
50+
<Option Name="WTIesExportSim" Val="0"/>
51+
<Option Name="WTVcsExportSim" Val="0"/>
52+
<Option Name="WTRivieraExportSim" Val="0"/>
53+
<Option Name="WTActivehdlExportSim" Val="0"/>
54+
<Option Name="GenerateIPUpgradeLog" Val="TRUE"/>
55+
<Option Name="XSimRadix" Val="hex"/>
56+
<Option Name="XSimTimeUnit" Val="ns"/>
57+
<Option Name="XSimArrayDisplayLimit" Val="1024"/>
58+
<Option Name="XSimTraceLimit" Val="65536"/>
59+
<Option Name="SimTypes" Val="rtl"/>
60+
<Option Name="SimTypes" Val="bfm"/>
61+
<Option Name="SimTypes" Val="tlm"/>
62+
<Option Name="SimTypes" Val="tlm_dpi"/>
63+
<Option Name="MEMEnableMemoryMapGeneration" Val="TRUE"/>
64+
<Option Name="DcpsUptoDate" Val="TRUE"/>
65+
</Configuration>
66+
<FileSets Version="1" Minor="31">
67+
<FileSet Name="sources_1" Type="DesignSrcs" RelSrcDir="$PSRCDIR/sources_1">
68+
<Filter Type="Srcs"/>
69+
<File Path="$PPRDIR/../mid.v">
70+
<FileInfo>
71+
<Attr Name="UsedIn" Val="synthesis"/>
72+
<Attr Name="UsedIn" Val="implementation"/>
73+
<Attr Name="UsedIn" Val="simulation"/>
74+
</FileInfo>
75+
</File>
76+
<Config>
77+
<Option Name="DesignMode" Val="RTL"/>
78+
<Option Name="TopModule" Val="mid"/>
79+
<Option Name="TopAutoSet" Val="TRUE"/>
80+
</Config>
81+
</FileSet>
82+
<FileSet Name="constrs_1" Type="Constrs" RelSrcDir="$PSRCDIR/constrs_1">
83+
<Filter Type="Constrs"/>
84+
<Config>
85+
<Option Name="ConstrsType" Val="XDC"/>
86+
</Config>
87+
</FileSet>
88+
<FileSet Name="sim_1" Type="SimulationSrcs" RelSrcDir="$PSRCDIR/sim_1">
89+
<File Path="$PPRDIR/../mid_test.v">
90+
<FileInfo>
91+
<Attr Name="UsedIn" Val="synthesis"/>
92+
<Attr Name="UsedIn" Val="implementation"/>
93+
<Attr Name="UsedIn" Val="simulation"/>
94+
</FileInfo>
95+
</File>
96+
<Config>
97+
<Option Name="DesignMode" Val="RTL"/>
98+
<Option Name="TopModule" Val="mid_test"/>
99+
<Option Name="TopLib" Val="xil_defaultlib"/>
100+
<Option Name="TopAutoSet" Val="TRUE"/>
101+
<Option Name="TransportPathDelay" Val="0"/>
102+
<Option Name="TransportIntDelay" Val="0"/>
103+
<Option Name="SelectedSimModel" Val="rtl"/>
104+
<Option Name="PamDesignTestbench" Val=""/>
105+
<Option Name="PamDutBypassFile" Val="xil_dut_bypass"/>
106+
<Option Name="PamSignalDriverFile" Val="xil_bypass_driver"/>
107+
<Option Name="PamPseudoTop" Val="pseudo_tb"/>
108+
<Option Name="SrcSet" Val="sources_1"/>
109+
</Config>
110+
</FileSet>
111+
<FileSet Name="utils_1" Type="Utils" RelSrcDir="$PSRCDIR/utils_1">
112+
<Filter Type="Utils"/>
113+
<Config>
114+
<Option Name="TopAutoSet" Val="TRUE"/>
115+
</Config>
116+
</FileSet>
117+
</FileSets>
118+
<Simulators>
119+
<Simulator Name="XSim">
120+
<Option Name="Description" Val="Vivado Simulator"/>
121+
<Option Name="CompiledLib" Val="0"/>
122+
</Simulator>
123+
<Simulator Name="ModelSim">
124+
<Option Name="Description" Val="ModelSim Simulator"/>
125+
</Simulator>
126+
<Simulator Name="Questa">
127+
<Option Name="Description" Val="Questa Advanced Simulator"/>
128+
</Simulator>
129+
<Simulator Name="IES">
130+
<Option Name="Description" Val="Incisive Enterprise Simulator (IES)"/>
131+
</Simulator>
132+
<Simulator Name="Xcelium">
133+
<Option Name="Description" Val="Xcelium Parallel Simulator"/>
134+
</Simulator>
135+
<Simulator Name="VCS">
136+
<Option Name="Description" Val="Verilog Compiler Simulator (VCS)"/>
137+
</Simulator>
138+
<Simulator Name="Riviera">
139+
<Option Name="Description" Val="Riviera-PRO Simulator"/>
140+
</Simulator>
141+
</Simulators>
142+
<Runs Version="1" Minor="11">
143+
<Run Id="synth_1" Type="Ft3:Synth" SrcSet="sources_1" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Vivado Synthesis Defaults" AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" Dir="$PRUNDIR/synth_1" IncludeInArchive="true">
144+
<Strategy Version="1" Minor="2">
145+
<StratHandle Name="Vivado Synthesis Defaults" Flow="Vivado Synthesis 2020">
146+
<Desc>Vivado Synthesis Defaults</Desc>
147+
</StratHandle>
148+
<Step Id="synth_design"/>
149+
</Strategy>
150+
<GeneratedRun Dir="$PRUNDIR" File="gen_run.xml"/>
151+
<ReportStrategy Name="Vivado Synthesis Default Reports" Flow="Vivado Synthesis 2020"/>
152+
<Report Name="ROUTE_DESIGN.REPORT_METHODOLOGY" Enabled="1"/>
153+
<RQSFiles/>
154+
</Run>
155+
<Run Id="impl_1" Type="Ft2:EntireDesign" Part="xc7a35tcsg324-1" ConstrsSet="constrs_1" Description="Default settings for Implementation." AutoIncrementalCheckpoint="false" WriteIncrSynthDcp="false" State="current" SynthRun="synth_1" IncludeInArchive="true" GenFullBitstream="true">
156+
<Strategy Version="1" Minor="2">
157+
<StratHandle Name="Vivado Implementation Defaults" Flow="Vivado Implementation 2020">
158+
<Desc>Default settings for Implementation.</Desc>
159+
</StratHandle>
160+
<Step Id="init_design"/>
161+
<Step Id="opt_design"/>
162+
<Step Id="power_opt_design"/>
163+
<Step Id="place_design"/>
164+
<Step Id="post_place_power_opt_design"/>
165+
<Step Id="phys_opt_design"/>
166+
<Step Id="route_design"/>
167+
<Step Id="post_route_phys_opt_design"/>
168+
<Step Id="write_bitstream"/>
169+
</Strategy>
170+
<ReportStrategy Name="Vivado Implementation Default Reports" Flow="Vivado Implementation 2020"/>
171+
<Report Name="ROUTE_DESIGN.REPORT_METHODOLOGY" Enabled="1"/>
172+
<RQSFiles/>
173+
</Run>
174+
</Runs>
175+
<Board/>
176+
<DashboardSummary Version="1" Minor="0">
177+
<Dashboards>
178+
<Dashboard Name="default_dashboard">
179+
<Gadgets>
180+
<Gadget Name="drc_1" Type="drc" Version="1" Row="2" Column="0">
181+
<GadgetParam Name="REPORTS" Type="string_list" Value="impl_1#impl_1_route_report_drc_0 "/>
182+
</Gadget>
183+
<Gadget Name="methodology_1" Type="methodology" Version="1" Row="2" Column="1">
184+
<GadgetParam Name="REPORTS" Type="string_list" Value="impl_1#impl_1_route_report_methodology_0 "/>
185+
</Gadget>
186+
<Gadget Name="power_1" Type="power" Version="1" Row="1" Column="0">
187+
<GadgetParam Name="REPORTS" Type="string_list" Value="impl_1#impl_1_route_report_power_0 "/>
188+
</Gadget>
189+
<Gadget Name="timing_1" Type="timing" Version="1" Row="0" Column="1">
190+
<GadgetParam Name="REPORTS" Type="string_list" Value="impl_1#impl_1_route_report_timing_summary_0 "/>
191+
</Gadget>
192+
<Gadget Name="utilization_1" Type="utilization" Version="1" Row="0" Column="0">
193+
<GadgetParam Name="REPORTS" Type="string_list" Value="synth_1#synth_1_synth_report_utilization_0 "/>
194+
<GadgetParam Name="RUN.STEP" Type="string" Value="synth_design"/>
195+
<GadgetParam Name="RUN.TYPE" Type="string" Value="synthesis"/>
196+
</Gadget>
197+
<Gadget Name="utilization_2" Type="utilization" Version="1" Row="1" Column="1">
198+
<GadgetParam Name="REPORTS" Type="string_list" Value="impl_1#impl_1_place_report_utilization_0 "/>
199+
</Gadget>
200+
</Gadgets>
201+
</Dashboard>
202+
<CurrentDashboard>default_dashboard</CurrentDashboard>
203+
</Dashboards>
204+
</DashboardSummary>
205+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
`timescale 1ns / 1ps
2+
3+
module mid_test ();
4+
reg [3:0] A, B ,C;
5+
wire [3:0] X;
6+
7+
mid UUT (.A(A), .B(B), .C(C), .Z(X));
8+
9+
initial begin
10+
#100 A = 4'b0011; B = 4'b0001; C = 4'b0010;
11+
#100 A = 4'b0001; B = 4'b0101; C = 4'b0100;
12+
#100 A = 4'b1110; B = 4'b1001; C = 4'b1111;
13+
#100 A = 4'b0001; B = 4'b0001; C = 4'b0001;
14+
end
15+
16+
initial begin
17+
#500;
18+
$finish;
19+
end
20+
21+
endmodule // mid_test
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module min (A, B, C, Y);
2+
input [3:0] A, B, C;
3+
output [3:0] Y;
4+
reg [3:0] Y;
5+
6+
always @ (A or B or C) begin
7+
if (A > B & C > B) begin
8+
Y = B;
9+
end else if (A > C & B > C) begin
10+
Y = C;
11+
end else if (C > A & B > A) begin
12+
Y = A;
13+
end else if (C == A & B == A) begin
14+
Y = A;
15+
end
16+
17+
end
18+
19+
endmodule // min

0 commit comments

Comments
 (0)