Hochladen der vorherigen Laborübungen.

Die Dateien selbst wurden nicht verändert.
This commit is contained in:
2024-02-22 10:42:38 +01:00
parent e114dd98d9
commit 7d9ff524f9
293 changed files with 12180 additions and 0 deletions

View File

@@ -0,0 +1,324 @@
; Copyright 1991-2009 Mentor Graphics Corporation
;
; All Rights Reserved.
;
; THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS THE PROPERTY OF
; MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS SUBJECT TO LICENSE TERMS.
;
[Library]
others = $MODEL_TECH/../modelsim.ini
; Altera Primitive libraries
;
; VHDL Section
;
;
; Verilog Section
;
work = work
[vcom]
; VHDL93 variable selects language version as the default.
; Default is VHDL-2002.
; Value of 0 or 1987 for VHDL-1987.
; Value of 1 or 1993 for VHDL-1993.
; Default or value of 2 or 2002 for VHDL-2002.
; Default or value of 3 or 2008 for VHDL-2008.
VHDL93 = 2002
; Show source line containing error. Default is off.
; Show_source = 1
; Turn off unbound-component warnings. Default is on.
; Show_Warning1 = 0
; Turn off process-without-a-wait-statement warnings. Default is on.
; Show_Warning2 = 0
; Turn off null-range warnings. Default is on.
; Show_Warning3 = 0
; Turn off no-space-in-time-literal warnings. Default is on.
; Show_Warning4 = 0
; Turn off multiple-drivers-on-unresolved-signal warnings. Default is on.
; Show_Warning5 = 0
; Turn off optimization for IEEE std_logic_1164 package. Default is on.
; Optimize_1164 = 0
; Turn on resolving of ambiguous function overloading in favor of the
; "explicit" function declaration (not the one automatically created by
; the compiler for each type declaration). Default is off.
; The .ini file has Explicit enabled so that std_logic_signed/unsigned
; will match the behavior of synthesis tools.
Explicit = 1
; Turn off acceleration of the VITAL packages. Default is to accelerate.
; NoVital = 1
; Turn off VITAL compliance checking. Default is checking on.
; NoVitalCheck = 1
; Ignore VITAL compliance checking errors. Default is to not ignore.
; IgnoreVitalErrors = 1
; Turn off VITAL compliance checking warnings. Default is to show warnings.
; Show_VitalChecksWarnings = 0
; Keep silent about case statement static warnings.
; Default is to give a warning.
; NoCaseStaticError = 1
; Keep silent about warnings caused by aggregates that are not locally static.
; Default is to give a warning.
; NoOthersStaticError = 1
; Turn off inclusion of debugging info within design units.
; Default is to include debugging info.
; NoDebug = 1
; Turn off "Loading..." messages. Default is messages on.
; Quiet = 1
; Turn on some limited synthesis rule compliance checking. Checks only:
; -- signals used (read) by a process must be in the sensitivity list
; CheckSynthesis = 1
; Activate optimizations on expressions that do not involve signals,
; waits, or function/procedure/task invocations. Default is off.
; ScalarOpts = 1
; Require the user to specify a configuration for all bindings,
; and do not generate a compile time default binding for the
; component. This will result in an elaboration error of
; 'component not bound' if the user fails to do so. Avoids the rare
; issue of a false dependency upon the unused default binding.
; RequireConfigForAllDefaultBinding = 1
; Inhibit range checking on subscripts of arrays. Range checking on
; scalars defined with subtypes is inhibited by default.
; NoIndexCheck = 1
; Inhibit range checks on all (implicit and explicit) assignments to
; scalar objects defined with subtypes.
; NoRangeCheck = 1
[vlog]
; Turn off inclusion of debugging info within design units.
; Default is to include debugging info.
; NoDebug = 1
; Turn off "loading..." messages. Default is messages on.
; Quiet = 1
; Turn on Verilog hazard checking (order-dependent accessing of global vars).
; Default is off.
; Hazard = 1
; Turn on converting regular Verilog identifiers to uppercase. Allows case
; insensitivity for module names. Default is no conversion.
; UpCase = 1
; Turn on incremental compilation of modules. Default is off.
; Incremental = 1
; Turns on lint-style checking.
; Show_Lint = 1
[vsim]
; Simulator resolution
; Set to fs, ps, ns, us, ms, or sec with optional prefix of 1, 10, or 100.
Resolution = ps
; User time unit for run commands
; Set to default, fs, ps, ns, us, ms, or sec. The default is to use the
; unit specified for Resolution. For example, if Resolution is 100ps,
; then UserTimeUnit defaults to ps.
; Should generally be set to default.
UserTimeUnit = default
; Default run length
RunLength = 100
; Maximum iterations that can be run without advancing simulation time
IterationLimit = 5000
; Directive to license manager:
; vhdl Immediately reserve a VHDL license
; vlog Immediately reserve a Verilog license
; plus Immediately reserve a VHDL and Verilog license
; nomgc Do not look for Mentor Graphics Licenses
; nomti Do not look for Model Technology Licenses
; noqueue Do not wait in the license queue when a license isn't available
; viewsim Try for viewer license but accept simulator license(s) instead
; of queuing for viewer license
; License = plus
; Stop the simulator after a VHDL/Verilog assertion message
; 0 = Note 1 = Warning 2 = Error 3 = Failure 4 = Fatal
BreakOnAssertion = 3
; Assertion Message Format
; %S - Severity Level
; %R - Report Message
; %T - Time of assertion
; %D - Delta
; %I - Instance or Region pathname (if available)
; %% - print '%' character
; AssertionFormat = "** %S: %R\n Time: %T Iteration: %D%I\n"
; Assertion File - alternate file for storing VHDL/Verilog assertion messages
; AssertFile = assert.log
; Default radix for all windows and commands...
; Set to symbolic, ascii, binary, octal, decimal, hex, unsigned
DefaultRadix = symbolic
; VSIM Startup command
; Startup = do startup.do
; File for saving command transcript
TranscriptFile = transcript
; File for saving command history
; CommandHistory = cmdhist.log
; Specify whether paths in simulator commands should be described
; in VHDL or Verilog format.
; For VHDL, PathSeparator = /
; For Verilog, PathSeparator = .
; Must not be the same character as DatasetSeparator.
PathSeparator = /
; Specify the dataset separator for fully rooted contexts.
; The default is ':'. For example, sim:/top
; Must not be the same character as PathSeparator.
DatasetSeparator = :
; Disable VHDL assertion messages
; IgnoreNote = 1
; IgnoreWarning = 1
; IgnoreError = 1
; IgnoreFailure = 1
; Default force kind. May be freeze, drive, deposit, or default
; or in other terms, fixed, wired, or charged.
; A value of "default" will use the signal kind to determine the
; force kind, drive for resolved signals, freeze for unresolved signals
; DefaultForceKind = freeze
; If zero, open files when elaborated; otherwise, open files on
; first read or write. Default is 0.
; DelayFileOpen = 1
; Control VHDL files opened for write.
; 0 = Buffered, 1 = Unbuffered
UnbufferedOutput = 0
; Control the number of VHDL files open concurrently.
; This number should always be less than the current ulimit
; setting for max file descriptors.
; 0 = unlimited
ConcurrentFileLimit = 40
; Control the number of hierarchical regions displayed as
; part of a signal name shown in the Wave window.
; A value of zero tells VSIM to display the full name.
; The default is 0.
; WaveSignalNameWidth = 0
; Turn off warnings from the std_logic_arith, std_logic_unsigned
; and std_logic_signed packages.
; StdArithNoWarnings = 1
; Turn off warnings from the IEEE numeric_std and numeric_bit packages.
; NumericStdNoWarnings = 1
; Control the format of the (VHDL) FOR generate statement label
; for each iteration. Do not quote it.
; The format string here must contain the conversion codes %s and %d,
; in that order, and no other conversion codes. The %s represents
; the generate_label; the %d represents the generate parameter value
; at a particular generate iteration (this is the position number if
; the generate parameter is of an enumeration type). Embedded whitespace
; is allowed (but discouraged); leading and trailing whitespace is ignored.
; Application of the format must result in a unique scope name over all
; such names in the design so that name lookup can function properly.
; GenerateFormat = %s__%d
; Specify whether checkpoint files should be compressed.
; The default is 1 (compressed).
; CheckpointCompressMode = 0
; List of dynamically loaded objects for Verilog PLI applications
; Veriuser = veriuser.sl
; Specify default options for the restart command. Options can be one
; or more of: -force -nobreakpoint -nolist -nolog -nowave
; DefaultRestartOptions = -force
; HP-UX 10.20 ONLY - Enable memory locking to speed up large designs
; (> 500 megabyte memory footprint). Default is disabled.
; Specify number of megabytes to lock.
; LockedMemory = 1000
; Turn on (1) or off (0) WLF file compression.
; The default is 1 (compress WLF file).
; WLFCompress = 0
; Specify whether to save all design hierarchy (1) in the WLF file
; or only regions containing logged signals (0).
; The default is 0 (save only regions with logged signals).
; WLFSaveAllRegions = 1
; WLF file time limit. Limit WLF file by time, as closely as possible,
; to the specified amount of simulation time. When the limit is exceeded
; the earliest times get truncated from the file.
; If both time and size limits are specified the most restrictive is used.
; UserTimeUnits are used if time units are not specified.
; The default is 0 (no limit). Example: WLFTimeLimit = {100 ms}
; WLFTimeLimit = 0
; WLF file size limit. Limit WLF file size, as closely as possible,
; to the specified number of megabytes. If both time and size limits
; are specified then the most restrictive is used.
; The default is 0 (no limit).
; WLFSizeLimit = 1000
; Specify whether or not a WLF file should be deleted when the
; simulation ends. A value of 1 will cause the WLF file to be deleted.
; The default is 0 (do not delete WLF file when simulation ends).
; WLFDeleteOnQuit = 1
; Automatic SDF compilation
; Disables automatic compilation of SDF files in flows that support it.
; Default is on, uncomment to turn off.
; NoAutoSDFCompile = 1
[lmc]
[msg_system]
; Change a message severity or suppress a message.
; The format is: <msg directive> = <msg number>[,<msg number>...]
; Examples:
; note = 3009
; warning = 3033
; error = 3010,3016
; fatal = 3016,3033
; suppress = 3009,3016,3043
; The command verror <msg number> can be used to get the complete
; description of a message.
; Control transcripting of elaboration/runtime messages.
; The default is to have messages appear in the transcript and
; recorded in the wlf file (messages that are recorded in the
; wlf file can be viewed in the MsgViewer). The other settings
; are to send messages only to the transcript or only to the
; wlf file. The valid values are
; both {default}
; tran {transcript only}
; wlf {wlf file only}
; msgmode = both

View File

@@ -0,0 +1,20 @@
# simulation control script for counters testbench
# prepare working library
file delete -force work
vlib work
vmap work work
# compile testbench
vlog tb_counter.v
# compile design under test
vlog ../src/mod_n_counter_10bit.v
# execute simulation
vsim -c -t ps tb_counter
# display simulation waveforms
do sim_counters_wave.tcl
# run simulation for 500ns
run 500 ns

View File

@@ -0,0 +1,24 @@
# simulation control script for counters_leds testbench
# prepare working library
file delete -force work
vlib work
vmap work work
puts "Compile Testbench"
vlog tb_counters_leds.v
puts "Compile DUT modules"
vlog ../src/counters_leds.v \
../src/mod_n_counter_10bit.v \
../src/d_ff.v \
+define+SIMULATION
puts "Starting Simulation"
vsim -c -t ps tb_counters_leds
# display simulation waveforms
do sim_counters_leds_wave.tcl
# run simulation for 500ns
run 15 us

View File

@@ -0,0 +1,23 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /tb_counters_leds/clock_50_tb
add wave -noupdate -expand /tb_counters_leds/key_tb
add wave -noupdate -expand /tb_counters_leds/ledg_tb
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {16044725 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 150
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 5000
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ns
update
WaveRestoreZoom {0 ps} {20250624 ps}

View File

@@ -0,0 +1,18 @@
# simulation control script for counters testbench
# prepare working library
file delete -force work
vlib work
vmap work work
# compile testbench
vlog tb_counter.v
# compile design under test
# execute simulation
# display simulation waveforms
do wave.do
# run simulation for 500ns

View File

@@ -0,0 +1,27 @@
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /tb_counter/clk_tb
add wave -noupdate /tb_counter/rst_tb
add wave -noupdate /tb_counter/en_tb
add wave -noupdate /tb_counter/q_tb_dut_1
add wave -noupdate /tb_counter/tc_tb_dut_1
add wave -noupdate /tb_counter/q_tb_dut_2
add wave -noupdate /tb_counter/tc_tb_dut_2
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {0 ps} 0}
quietly wave cursor active 0
configure wave -namecolwidth 150
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 0
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 5000
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ns
update
WaveRestoreZoom {499413 ps} {500031 ps}

View File

@@ -0,0 +1,86 @@
// counter testbench
`timescale 1ns/1ps
module tb_counter();
// DUT inputs
reg clk_tb;
reg rst_tb;
reg en_tb;
// DUT 1 outputs
wire [9:0] q_tb_dut_1;
wire tc_tb_dut_1;
// DUT 2 outputs
wire [9:0] q_tb_dut_2;
wire tc_tb_dut_2;
integer i = 0;
initial begin
clk_tb = 1'b0;
rst_tb = 1'b0;
en_tb = 1'b0;
end
// Create 50 MHz clock
always begin
#10;
clk_tb = ~clk_tb;
end
initial begin
// delay for four clk cycles
for (i = 0; i < 4; i = i+1) begin
@(negedge clk_tb);
end
// assert reset
rst_tb <= 1'b1;
@(negedge clk_tb);
// de-assert reset
rst_tb <= 1'b0;
@(negedge clk_tb);
// enable counter for 8 cycles
en_tb = 1'b1;
for (i = 0 ; i < 8 ; i = i+1 ) begin
@(negedge clk_tb);
end
// disable counter
en_tb = 1'b0;
// wait some time
@(negedge clk_tb);
@(negedge clk_tb);
// enable counter again
en_tb = 1'b1;
end
// DUT 1 instance
mod_n_counter_10bit DUT_1(
//module inputs
.CLK(clk_tb),
.RST(rst_tb),
.EN(en_tb),
//module outputs
.Q(q_tb_dut_1),
.TC(tc_tb_dut_1)
);
// DUT 2 instance
mod_n_counter_10bit #(.N(12)) DUT2(
.CLK(clk_tb),
.RST(rst_tb),
.EN(en_tb),
.Q(q_tb_dut_2),
.TC(tc_tb_dut_2)
);
endmodule

View File

@@ -0,0 +1,55 @@
// counter testbench
`timescale 1ns/1ps
module tb_counter();
// DUT inputs
// DUT 1 outputs
// DUT 2 outputs
integer i = 0;
// Create 50 MHz clock
initial begin
clk_tb = 1'b0;
rst_tb = 1'b0;
en_tb = 1'b0;
// delay for four clk cycles
for (i = 0; i < 4; i = i+1) begin
@(negedge clk_tb);
end
// assert reset
rst_tb <= 1'b0;
@(negedge clk_tb);
// de-assert reset
rst_tb <= 1'b1;
@(negedge clk_tb);
// enable counter for 8 cycles
// disable counter
// wait some time
@(negedge clk_tb);
@(negedge clk_tb);
// enable counter again
en_tb = 1'b1;
end
// DUT 1 instance
// DUT 2 instance
endmodule

View File

@@ -0,0 +1,43 @@
//counters_leds testbench
`timescale 1ns/1ps
module tb_counters_leds();
reg clock_50_tb;
reg [0:0] key_tb;
wire [2:0] ledg_tb;
integer i = 0;
initial begin
clock_50_tb = 1'b0;
key_tb = 1'b0;
end
always begin
#10;
clock_50_tb = ~clock_50_tb;
end
initial begin
// delay for four clk cycles
for (i = 0; i < 4; i = i+1) begin
@(negedge clock_50_tb);
end
// assert reset
key_tb <= 1'b0;
@(negedge clock_50_tb);
// de-assert reset
key_tb <= 1'b1;
@(negedge clock_50_tb);
end
counters_leds DUT(
.CLOCK_50(clock_50_tb),
.KEY(key_tb),
.LEDG(ledg_tb)
);
endmodule

Binary file not shown.

View File

@@ -0,0 +1,84 @@
m255
K3
13
cModel Technology
Z0 dC:\Users\Musab Erdem\Nextcloud\Dokumente\Studium\DHBW\Semester 4\Labor_EDS\Uebungen\counters_leds\sim
vcounters_leds
!i10b 1
!s100 @Kic8Wh[SiKe]YRHnamgH3
IgUJ4zDcHcLNFe1EMEO@1K1
V7^_5Kedk`C4@^EKJ[8Ih@3
Z1 dC:\Users\Musab Erdem\Nextcloud\Dokumente\Studium\DHBW\Semester 4\Labor_EDS\Uebungen\counters_leds\sim
w1708005631
8../src/counters_leds.v
F../src/counters_leds.v
L0 2
Z2 OV;L;10.1d;51
r1
!s85 0
31
Z3 !s108 1708007877.947000
Z4 !s107 ../src/d_ff.v|../src/mod_n_counter_10bit.v|../src/counters_leds.v|
Z5 !s90 -reportprogress|300|../src/counters_leds.v|../src/mod_n_counter_10bit.v|../src/d_ff.v|+define+SIMULATION|
!s101 -O0
o-O0
Z6 !s92 +define+SIMULATION -O0
vd_ff
!i10b 1
!s100 S0oLk;QnQN0nI[WT@=?bi0
IV@Ba:bKmPj`UBMRLkSkVA2
V4D<[LJL>3N2`cK3Z?dERO3
R1
w1707529390
8../src/d_ff.v
F../src/d_ff.v
L0 1
R2
r1
!s85 0
31
R3
R4
R5
!s101 -O0
o-O0
R6
vmod_n_counter_10bit
!i10b 1
!s100 g]04;fWmVhoOj9;HHIgYX2
I`RC:GYVi2N6O1XmzDB4VX0
VOCKRzhG[H7hm^_`n>48^e3
R1
w1707528374
8../src/mod_n_counter_10bit.v
F../src/mod_n_counter_10bit.v
L0 2
R2
r1
!s85 0
31
R3
R4
R5
!s101 -O0
o-O0
R6
vtb_counters_leds
Z7 I[eMPoU]0F76mUMMz[n<T62
Z8 V0D1=BJhTYcNPZ7HY;LUDO1
R1
Z9 w1707532567
Z10 8tb_counters_leds.v
Z11 Ftb_counters_leds.v
L0 4
R2
r1
31
o-O0
!i10b 1
Z12 !s100 d7FE1cWQG02hfJ@VLJA_z0
!s85 0
Z13 !s108 1708007877.876000
Z14 !s107 tb_counters_leds.v|
Z15 !s90 -reportprogress|300|tb_counters_leds.v|
!s101 -O0

View File

@@ -0,0 +1,3 @@
m255
K3
cModel Technology

View File

@@ -0,0 +1,9 @@
library verilog;
use verilog.vl_types.all;
entity counters_leds is
port(
CLOCK_50 : in vl_logic;
KEY : in vl_logic_vector(0 downto 0);
LEDG : out vl_logic_vector(2 downto 0)
);
end counters_leds;

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,12 @@
library verilog;
use verilog.vl_types.all;
entity d_ff is
port(
D : in vl_logic;
CLK : in vl_logic;
RST : in vl_logic;
ENA : in vl_logic;
Q : out vl_logic;
Qn : out vl_logic
);
end d_ff;

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,16 @@
library verilog;
use verilog.vl_types.all;
entity mod_n_counter_10bit is
generic(
N : integer := 10
);
port(
CLK : in vl_logic;
RST : in vl_logic;
EN : in vl_logic;
Q : out vl_logic_vector(9 downto 0);
TC : out vl_logic
);
attribute mti_svvh_generic_type : integer;
attribute mti_svvh_generic_type of N : constant is 1;
end mod_n_counter_10bit;

View File

@@ -0,0 +1,4 @@
library verilog;
use verilog.vl_types.all;
entity tb_counters_leds is
end tb_counters_leds;