origen_sim 0.16.1 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/application.rb +2 -0
- data/config/commands.rb +29 -20
- data/config/version.rb +2 -2
- data/ext/bridge.c +72 -14
- data/ext/origen.c +29 -17
- data/ext/origen.h +6 -0
- data/ext/origen_tasks.tab +2 -0
- data/lib/origen_sim/commands/build.rb +90 -59
- data/lib/origen_sim/origen/pins/pin.rb +38 -0
- data/lib/origen_sim/origen/top_level.rb +8 -3
- data/lib/origen_sim/simulation.rb +1 -1
- data/lib/origen_sim/simulator/user_details.rb +0 -1
- data/lib/origen_sim/simulator.rb +70 -70
- data/lib/origen_sim/tester.rb +53 -10
- data/lib/origen_sim_dev/dut.rb +66 -46
- data/lib/origen_sim_dev/ip.rb +15 -8
- data/pattern/concurrent_ip.rb +17 -0
- data/pattern/test.rb +122 -10
- data/templates/empty.rc +16 -26
- data/templates/origen_guides/simulation/ams.md.erb +141 -0
- data/templates/origen_guides/simulation/compiling.md.erb +52 -7
- data/templates/origen_guides/simulation/debugging.md.erb +1 -1
- data/templates/origen_guides/simulation/direct.md.erb +112 -0
- data/templates/origen_guides/simulation/environment.md.erb +6 -3
- data/templates/origen_guides/simulation/patterns.md.erb +2 -7
- data/templates/rtl_v/origen.v.erb +114 -12
- metadata +13 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dc77dd81416662c4ecff9e01c03a7ed7a01cc31d79087ec6c9340cd72e0dd7f
|
4
|
+
data.tar.gz: 223d8e87547338de2ddf5061c5789b2f09c576e4acb448d666d9f4305db6acbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f29952826fecf63d1e7c96f96ebee945a0d48685ac21771138ea7c4dca51f0c433e2ea1198c9ea76068fb28528fc3af1320131dca5fb4ef0db8527494f8a7c56
|
7
|
+
data.tar.gz: 00db5869a5ebb43ae9138011ac0c36a649547fb37a9fb86f1b32bdf96588815fb4a11f78c0535b8ab258117011d001dac6030044dff266c6aaf503e5c4be1d12
|
data/config/application.rb
CHANGED
@@ -36,10 +36,12 @@ class OrigenSimApplication < Origen::Application
|
|
36
36
|
section.page :introduction, heading: "Introduction"
|
37
37
|
section.page :howitworks, heading: "How It Works"
|
38
38
|
section.page :compiling, heading: "Compiling the DUT"
|
39
|
+
section.page :ams, heading: "AMS Support"
|
39
40
|
section.page :environment, heading: "Environment Setup"
|
40
41
|
section.page :app, heading: "Application Setup"
|
41
42
|
section.page :patterns, heading: "Simulating Patterns"
|
42
43
|
section.page :flows, heading: "Simulating Flows"
|
44
|
+
section.page :direct, heading: "Direct DUT Manipulation"
|
43
45
|
section.page :log, heading: "Simulator Log Output"
|
44
46
|
section.page :artifacts, heading: "Artifacts"
|
45
47
|
section.page :debugging, heading: "Debugging"
|
data/config/commands.rb
CHANGED
@@ -17,33 +17,42 @@ case @command
|
|
17
17
|
# in here or you can require an external file if preferred.
|
18
18
|
when "sim:build_example"
|
19
19
|
Dir.chdir(Origen.root) do
|
20
|
-
|
20
|
+
cmd = "origen sim:build #{Origen.app.remotes_dir}/example_rtl/dut1/stub.v"
|
21
|
+
if ARGV.include?('-e') || ARGV.include?('--environment')
|
22
|
+
index = ARGV.index('-e') || ARGV.index('--environment')
|
23
|
+
ARGV.delete_at(index)
|
24
|
+
Origen.environment.temporary = ARGV.delete_at(index)
|
25
|
+
end
|
26
|
+
cmd += ' ' + ARGV.join(' ') unless ARGV.empty?
|
27
|
+
# Enable wreal pins in the DUT RTL
|
28
|
+
cmd += ' --define ORIGEN_WREAL' if ARGV.include?('--wreal')
|
29
|
+
output = `#{cmd}`
|
21
30
|
puts output
|
22
31
|
Origen.load_target
|
23
32
|
dir = "simulation/default/#{tester.simulator.config[:vendor]}"
|
24
|
-
FileUtils.rm_rf(dir) if File.exist?(dir)
|
25
33
|
FileUtils.mkdir_p(dir)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
Dir.chdir dir do
|
35
|
+
case tester.simulator.config[:vendor]
|
36
|
+
when :icarus
|
37
|
+
output =~ / (cd .*)\n/
|
38
|
+
system $1.gsub('stub', 'dut1')
|
39
|
+
FileUtils.mv "#{Origen.config.output_directory}/origen.vpi", '.'
|
40
|
+
output =~ /\n(.*iverilog .*)\n/
|
41
|
+
system $1.gsub('stub', 'dut1')
|
34
42
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
FileUtils.mv "INCA_libs", "simulation/default/cadence"
|
43
|
+
when :cadence
|
44
|
+
output =~ /\n(.*irun .*)\n/
|
45
|
+
system $1.gsub('stub', 'dut1')
|
39
46
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
when :synopsys
|
48
|
+
if tester.simulator.config[:verdi]
|
49
|
+
output =~ /\n(.*vcs .*ORIGEN_FSDB.*)\n/
|
50
|
+
else
|
51
|
+
output =~ /\n(.*vcs .*ORIGEN_VPD.*)\n/
|
52
|
+
end
|
53
|
+
system $1.gsub('stub', 'dut1')
|
46
54
|
|
55
|
+
end
|
47
56
|
end
|
48
57
|
|
49
58
|
puts
|
data/config/version.rb
CHANGED
data/ext/bridge.c
CHANGED
@@ -723,18 +723,25 @@ PLI_INT32 bridge_wait_for_msg(p_cb_data data) {
|
|
723
723
|
end_simulation();
|
724
724
|
return 0;
|
725
725
|
// Peek
|
726
|
-
// Returns the current value of the given net
|
726
|
+
// Returns the current value of the given net, the 2nd argument specifies whether to
|
727
|
+
// return an integer or a float/real value
|
727
728
|
//
|
728
|
-
// 9^origen.debug.errors
|
729
|
+
// 9^origen.debug.errors^i
|
730
|
+
// 9^origen.dut.my_real_val^f
|
729
731
|
case '9' :
|
730
732
|
arg1 = strtok(NULL, "^");
|
733
|
+
arg2 = strtok(NULL, "^");
|
731
734
|
handle = vpi_handle_by_name(arg1, NULL);
|
732
735
|
if (handle) {
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
736
|
+
if (*arg2 == 'i') {
|
737
|
+
v.format = vpiBinStrVal;
|
738
|
+
vpi_get_value(handle, &v);
|
739
|
+
sprintf(msg, "%s\n", v.value.str);
|
740
|
+
} else {
|
741
|
+
v.format = vpiRealVal;
|
742
|
+
vpi_get_value(handle, &v);
|
743
|
+
sprintf(msg, "%f\n", v.value.real);
|
744
|
+
}
|
738
745
|
client_put(msg);
|
739
746
|
} else {
|
740
747
|
client_put("FAIL\n");
|
@@ -751,17 +758,25 @@ PLI_INT32 bridge_wait_for_msg(p_cb_data data) {
|
|
751
758
|
vpi_put_value(handle, &v, NULL, vpiNoDelay);
|
752
759
|
break;
|
753
760
|
// Poke
|
754
|
-
// Sets the given value on the given net, the number should be
|
755
|
-
//
|
761
|
+
// Sets the given value on the given net, the number should be given
|
762
|
+
// as a decimal string, an integer or a float, and the 2nd argument specifies
|
763
|
+
// which has been given
|
756
764
|
//
|
757
|
-
// b^origen.debug.errors^15
|
765
|
+
// b^origen.debug.errors^i^15
|
766
|
+
// b^origen.dut.my_real_val^f^1.12
|
758
767
|
case 'b' :
|
759
768
|
arg1 = strtok(NULL, "^");
|
760
769
|
arg2 = strtok(NULL, "^");
|
770
|
+
arg3 = strtok(NULL, "^");
|
761
771
|
handle = vpi_handle_by_name(arg1, NULL);
|
762
772
|
if (handle) {
|
763
|
-
|
764
|
-
|
773
|
+
if (*arg2 == 'i') {
|
774
|
+
v.format = vpiDecStrVal;
|
775
|
+
v.value.str = arg3;
|
776
|
+
} else {
|
777
|
+
v.format = vpiRealVal;
|
778
|
+
v.value.real = strtof(arg3, NULL);
|
779
|
+
}
|
765
780
|
vpi_put_value(handle, &v, NULL, vpiNoDelay);
|
766
781
|
}
|
767
782
|
break;
|
@@ -917,6 +932,41 @@ PLI_INT32 bridge_wait_for_msg(p_cb_data data) {
|
|
917
932
|
match_loop_open = false;
|
918
933
|
}
|
919
934
|
break;
|
935
|
+
// Force
|
936
|
+
// Forces the given value on the given net, the number should be given
|
937
|
+
// as a decimal string, an integer or a float, and the 2nd argument specifies
|
938
|
+
// which has been given
|
939
|
+
//
|
940
|
+
// r^origen.dut.some.net^i^1^
|
941
|
+
// r^origen.dut.some.net^f^1.25
|
942
|
+
case 'r' :
|
943
|
+
arg1 = strtok(NULL, "^");
|
944
|
+
arg2 = strtok(NULL, "^");
|
945
|
+
arg3 = strtok(NULL, "^");
|
946
|
+
handle = vpi_handle_by_name(arg1, NULL);
|
947
|
+
if (handle) {
|
948
|
+
if (*arg2 == 'i') {
|
949
|
+
v.format = vpiDecStrVal;
|
950
|
+
v.value.str = arg3;
|
951
|
+
} else {
|
952
|
+
v.format = vpiRealVal;
|
953
|
+
v.value.real = strtof(arg3, NULL);
|
954
|
+
}
|
955
|
+
vpi_put_value(handle, &v, NULL, vpiForceFlag);
|
956
|
+
}
|
957
|
+
break;
|
958
|
+
// Release
|
959
|
+
// Releases an existing force on the given net
|
960
|
+
//
|
961
|
+
// s^origen.dut.some.net
|
962
|
+
// s^origen.dut.some.net
|
963
|
+
case 's' :
|
964
|
+
arg1 = strtok(NULL, "^");
|
965
|
+
handle = vpi_handle_by_name(arg1, NULL);
|
966
|
+
if (handle) {
|
967
|
+
vpi_put_value(handle, &v, NULL, vpiReleaseFlag);
|
968
|
+
}
|
969
|
+
break;
|
920
970
|
default :
|
921
971
|
origen_log(LOG_ERROR, "Illegal message received from Origen: %s", orig_msg);
|
922
972
|
runtime_errors += 1;
|
@@ -1034,7 +1084,11 @@ PLI_INT32 bridge_on_miscompare(PLI_BYTE8 * user_dat) {
|
|
1034
1084
|
|
1035
1085
|
vpi_free_object(argv);
|
1036
1086
|
|
1037
|
-
|
1087
|
+
if (received) {
|
1088
|
+
origen_log(LOG_ERROR, "Miscompare on pin %s, expected %d received %d", pin_name, expected, received);
|
1089
|
+
} else {
|
1090
|
+
origen_log(LOG_ERROR, "Miscompare on pin %s, expected %d received X or Z", pin_name, expected);
|
1091
|
+
}
|
1038
1092
|
|
1039
1093
|
error_count++;
|
1040
1094
|
|
@@ -1062,7 +1116,11 @@ PLI_INT32 bridge_on_miscompare(PLI_BYTE8 * user_dat) {
|
|
1062
1116
|
strcpy((*miscompare).pin_name, pin_name);
|
1063
1117
|
(*miscompare).cycle = cycle_count;
|
1064
1118
|
(*miscompare).expected = expected;
|
1065
|
-
(
|
1119
|
+
if (received) {
|
1120
|
+
(*miscompare).received = received;
|
1121
|
+
} else {
|
1122
|
+
(*miscompare).received = -1;
|
1123
|
+
}
|
1066
1124
|
}
|
1067
1125
|
transaction_error_count++;
|
1068
1126
|
}
|
data/ext/origen.c
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
/// this extension into the simulation
|
4
4
|
///
|
5
5
|
#include "origen.h"
|
6
|
+
#include "defines.h"
|
6
7
|
#include "bridge.h"
|
7
8
|
#include "client.h"
|
8
9
|
#include <string.h>
|
@@ -12,12 +13,38 @@ static void init(void);
|
|
12
13
|
|
13
14
|
static void init() {
|
14
15
|
register_callback(cbStartOfSimulation, origen_startup);
|
15
|
-
|
16
16
|
register_callback(cbEndOfSimulation, origen_shutdown);
|
17
|
-
|
18
17
|
bridge_register_system_tasks();
|
19
18
|
}
|
20
19
|
|
20
|
+
// This function is provided as another way to initialize Origen, by calling this manually
|
21
|
+
PLI_INT32 origen_init(p_cb_data data) {
|
22
|
+
vpi_printf("Origen Initialized!\n");
|
23
|
+
init();
|
24
|
+
return 0;
|
25
|
+
}
|
26
|
+
|
27
|
+
// Some legacy simulators require this manual initialization function to be called bootstrap, but
|
28
|
+
// otherwise equivalent to the origen_init() function
|
29
|
+
PLI_INT32 bootstrap(p_cb_data data) {
|
30
|
+
vpi_printf("Origen Initialized!\n");
|
31
|
+
init();
|
32
|
+
return 0;
|
33
|
+
}
|
34
|
+
|
35
|
+
#ifdef ORIGEN_VCS
|
36
|
+
// Origen will be initialized by calling the $origen_vcs_init task from the testbench, this is required
|
37
|
+
// for VCS since it does not allow multiple definitions of vlog_startup_routine, which is the
|
38
|
+
// conventional way of registering a VPI plugin.
|
39
|
+
PLI_INT32 origen_vcs_init(PLI_BYTE8 * user_dat) {
|
40
|
+
register_callback(cbEndOfSimulation, origen_shutdown);
|
41
|
+
return origen_startup(user_dat);
|
42
|
+
}
|
43
|
+
#else
|
44
|
+
// This is the standard way to initialize Origen, by registering this init function through the
|
45
|
+
// vlog_startup_routines. The simulator will then call this init function at simulation startup
|
46
|
+
void (*vlog_startup_routines[])(void) = { init, 0 };
|
47
|
+
#endif
|
21
48
|
|
22
49
|
/// Returns the value of the given argument, or NULL if not supplied.
|
23
50
|
/// This example:
|
@@ -87,15 +114,6 @@ PLI_INT32 origen_shutdown(p_cb_data data) {
|
|
87
114
|
return 0;
|
88
115
|
}
|
89
116
|
|
90
|
-
/// Function to call the init PLI's init function
|
91
|
-
/// Some toolchains will call this automatically, some will not
|
92
|
-
/// Available here for those which do not automatically call init() for each PLI
|
93
|
-
PLI_INT32 bootstrap(p_cb_data data) {
|
94
|
-
vpi_printf("Origen Bootstrap Called!\n");
|
95
|
-
init();
|
96
|
-
return 0;
|
97
|
-
}
|
98
|
-
|
99
117
|
///
|
100
118
|
/// Registers a very basic VPI callback with reason and handler.
|
101
119
|
///
|
@@ -112,9 +130,3 @@ static void register_callback(PLI_INT32 aReason, PLI_INT32 (*aHandler)(p_cb_data
|
|
112
130
|
|
113
131
|
vpi_free_object(vpi_register_cb(&call));
|
114
132
|
}
|
115
|
-
|
116
|
-
|
117
|
-
///
|
118
|
-
/// Bootstrap vector, make the simulator execute init() on startup
|
119
|
-
///
|
120
|
-
void (*vlog_startup_routines[])(void) = { init, 0 };
|
data/ext/origen.h
CHANGED
@@ -2,8 +2,14 @@
|
|
2
2
|
#define ORIGEN_H
|
3
3
|
|
4
4
|
#include "common.h"
|
5
|
+
#include "defines.h"
|
5
6
|
|
6
7
|
PLI_INT32 origen_startup(p_cb_data);
|
7
8
|
PLI_INT32 origen_shutdown(p_cb_data);
|
9
|
+
#ifdef ORIGEN_VCS
|
10
|
+
PLI_INT32 origen_vcs_init(PLI_BYTE8*);
|
11
|
+
#endif
|
12
|
+
PLI_INT32 origen_init(p_cb_data);
|
13
|
+
PLI_INT32 bootstrap(p_cb_data);
|
8
14
|
|
9
15
|
#endif
|
@@ -23,6 +23,7 @@ Usage: origen sim:build TOP_LEVEL_VERILOG_FILE [options]
|
|
23
23
|
options[:source_dirs] << path
|
24
24
|
end
|
25
25
|
opts.on('--sv', 'Generate a .sv file instead of a .v file.') { |t| options[:sv] = t }
|
26
|
+
opts.on('--wreal', 'Enable real number modeling support on DUT pins defined as real wires (wreal)') { |t| options[:wreal] = t }
|
26
27
|
opts.on('--verilog_top_output_name NAME', 'Renames the output filename from origen.v to NAME.v') do |name|
|
27
28
|
options[:verilog_top_output_name] = name
|
28
29
|
end
|
@@ -95,7 +96,7 @@ candidates = ast.top_level_modules
|
|
95
96
|
candidates = ast.modules if candidates.empty?
|
96
97
|
|
97
98
|
if candidates.size == 0
|
98
|
-
puts "Sorry, couldn't find any Verilog module declarations in that file"
|
99
|
+
puts "Sorry, couldn't find any Verilog module declarations in that file (this could be due to a parse error)"
|
99
100
|
_exit_fail_
|
100
101
|
elsif candidates.size > 1
|
101
102
|
if options[:top_level_name]
|
@@ -116,7 +117,7 @@ rtl_top_module = mod.name
|
|
116
117
|
|
117
118
|
mod.to_top_level # Creates dut
|
118
119
|
|
119
|
-
# Update the pins with any
|
120
|
+
# Update the pins with any settings from the command line
|
120
121
|
options[:initial_pin_states].each do |pin, state|
|
121
122
|
dut.pins(pin).meta[:origen_sim_init_pin_state] = state
|
122
123
|
end
|
@@ -157,51 +158,97 @@ else
|
|
157
158
|
|
158
159
|
dut.export(rtl_top_module, dir: "#{output_directory}", namespace: nil)
|
159
160
|
|
161
|
+
SYNOPSYS_SWITCHES = %W(
|
162
|
+
#{output_directory}/#{output_name}
|
163
|
+
#{output_directory}/bridge.c
|
164
|
+
#{output_directory}/client.c
|
165
|
+
-P\ #{output_directory}/origen_tasks.tab
|
166
|
+
-CFLAGS\ "-std=c99 -DORIGEN_VCS"
|
167
|
+
+vpi
|
168
|
+
#{output_directory}/origen.c
|
169
|
+
+define+ORIGEN_VCS
|
170
|
+
-debug_access+all
|
171
|
+
-timescale=1ns/1ns
|
172
|
+
-v2005
|
173
|
+
-full64
|
174
|
+
)
|
175
|
+
|
176
|
+
if options[:wreal]
|
177
|
+
SYNOPSYS_SWITCHES += %w(
|
178
|
+
+define+ORIGEN_WREAL
|
179
|
+
-realport
|
180
|
+
-sverilog
|
181
|
+
-wreal\ res_max
|
182
|
+
)
|
183
|
+
end
|
184
|
+
|
185
|
+
SYNOPSYS_DVE_SWITCHES = SYNOPSYS_SWITCHES + %w(
|
186
|
+
+define+ORIGEN_VPD
|
187
|
+
)
|
188
|
+
|
189
|
+
SYNOPSYS_VERDI_SWITCHES = SYNOPSYS_SWITCHES + %W(
|
190
|
+
+define+ORIGEN_FSDB
|
191
|
+
-kdb
|
192
|
+
-P\ #{ENV['VERDI_HOME'] || '$VERDI_HOME'}/share/PLI/VCS/LINUX64/novas.tab
|
193
|
+
#{ENV['VERDI_HOME'] || '$VERDI_HOME'}/share/PLI/VCS/LINUX64/pli.a
|
194
|
+
)
|
195
|
+
|
196
|
+
CADENCE_SWITCHES = %W(
|
197
|
+
#{output_directory}/#{output_name}
|
198
|
+
#{output_directory}/*.c
|
199
|
+
-ccargs\ "-std=c99"
|
200
|
+
-top\ origen
|
201
|
+
-elaborate
|
202
|
+
-snapshot\ origen
|
203
|
+
-access\ +rw
|
204
|
+
-timescale\ 1ns/1ns
|
205
|
+
)
|
206
|
+
|
207
|
+
if options[:wreal]
|
208
|
+
CADENCE_SWITCHES += %w(
|
209
|
+
+define+ORIGEN_WREAL
|
210
|
+
-ams
|
211
|
+
)
|
212
|
+
end
|
213
|
+
|
160
214
|
puts
|
161
215
|
puts
|
162
216
|
puts '-----------------------------------------------------------'
|
163
|
-
puts '
|
217
|
+
puts 'Icarus Verilog'
|
164
218
|
puts '-----------------------------------------------------------'
|
165
219
|
puts
|
220
|
+
puts 'Compile the VPI extension using the following command:'
|
221
|
+
puts
|
222
|
+
puts " cd #{output_directory} && #{ENV['ORIGEN_SIM_IVERILOG_VPI'] || 'iverilog-vpi'} *.c --name=origen && cd #{Pathname.pwd}"
|
223
|
+
puts
|
166
224
|
puts 'Add the following to your build script (AND REMOVE ANY OTHER TESTBENCH!):'
|
167
225
|
puts
|
168
226
|
puts " #{output_directory}/#{output_name} \\"
|
169
|
-
puts
|
170
|
-
puts ' -
|
171
|
-
puts ' -top origen \\'
|
172
|
-
puts ' -elaborate \\'
|
173
|
-
puts ' -snapshot origen \\'
|
174
|
-
puts ' -access +rw \\'
|
175
|
-
puts ' -timescale 1ns/1ns'
|
227
|
+
puts ' -o origen.vvp \\'
|
228
|
+
puts ' -DORIGEN_VCD'
|
176
229
|
puts
|
177
|
-
puts 'Here is an example which may work for the file you just parsed (add additional -
|
230
|
+
puts 'Here is an example which may work for the file you just parsed (add additional source dirs with more -I options at the end if required):'
|
178
231
|
puts
|
179
|
-
puts " #{ENV['
|
232
|
+
puts " #{ENV['ORIGEN_SIM_IVERILOG'] || 'iverilog'} #{rtl_top} #{output_directory}/#{output_name} -o origen.vvp -DORIGEN_VCD -I #{Pathname.new(rtl_top).dirname}"
|
180
233
|
puts
|
181
|
-
puts 'Copy the following
|
234
|
+
puts 'Copy the following files (produced by iverilog) to simulation/<target>/icarus/. within your Origen application:'
|
182
235
|
puts
|
183
|
-
puts
|
236
|
+
puts " #{output_directory}/origen.vpi"
|
237
|
+
puts ' origen.vvp'
|
184
238
|
puts
|
185
239
|
puts '-----------------------------------------------------------'
|
186
|
-
puts 'Synopsys VCS'
|
240
|
+
puts 'Synopsys VCS w/ DVE Waveviewer'
|
187
241
|
puts '-----------------------------------------------------------'
|
188
242
|
puts
|
189
243
|
puts 'Add the following to your build script (AND REMOVE ANY OTHER TESTBENCH!):'
|
190
244
|
puts
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
puts ' -CFLAGS "-std=c99" \\'
|
195
|
-
puts ' +vpi \\'
|
196
|
-
puts " #{output_directory}/origen.c \\"
|
197
|
-
puts ' +define+ORIGEN_VPD=1 \\'
|
198
|
-
puts ' -debug_access+all \\'
|
199
|
-
puts ' -PP \\'
|
200
|
-
puts ' -timescale=1ns/1ns'
|
245
|
+
SYNOPSYS_DVE_SWITCHES.each do |switch|
|
246
|
+
puts " #{switch} \\"
|
247
|
+
end
|
201
248
|
puts
|
202
|
-
puts 'Here is an example which may work for the file you just parsed (add additional
|
249
|
+
puts 'Here is an example which may work for the file you just parsed (add additional +incdir+ options at the end if required):'
|
203
250
|
puts
|
204
|
-
puts " #{ENV['ORIGEN_SIM_VCS'] || 'vcs'} #{rtl_top}
|
251
|
+
puts " #{ENV['ORIGEN_SIM_VCS'] || 'vcs'} #{rtl_top} +incdir+#{Pathname.new(rtl_top).dirname} " + SYNOPSYS_DVE_SWITCHES.join(' ')
|
205
252
|
puts
|
206
253
|
puts 'Copy the following files (produced by vcs) to simulation/<target>/synopsys/. within your Origen application:'
|
207
254
|
puts
|
@@ -209,57 +256,41 @@ else
|
|
209
256
|
puts ' simv.daidir'
|
210
257
|
puts
|
211
258
|
puts '-----------------------------------------------------------'
|
212
|
-
puts '
|
259
|
+
puts 'Synopsys VCS w/ Verdi Waveviewer'
|
213
260
|
puts '-----------------------------------------------------------'
|
214
261
|
puts
|
215
|
-
puts 'Compile the VPI extension using the following command:'
|
216
|
-
puts
|
217
|
-
puts " cd #{output_directory} && #{ENV['ORIGEN_SIM_IVERILOG_VPI'] || 'iverilog-vpi'} *.c --name=origen && cd #{Pathname.pwd}"
|
218
|
-
puts
|
219
262
|
puts 'Add the following to your build script (AND REMOVE ANY OTHER TESTBENCH!):'
|
220
263
|
puts
|
221
|
-
|
222
|
-
|
223
|
-
|
264
|
+
SYNOPSYS_VERDI_SWITCHES.each do |switch|
|
265
|
+
puts " #{switch} \\"
|
266
|
+
end
|
224
267
|
puts
|
225
|
-
puts 'Here is an example which may work for the file you just parsed (add additional
|
268
|
+
puts 'Here is an example which may work for the file you just parsed (add additional +incdir+ options at the end if required):'
|
226
269
|
puts
|
227
|
-
puts " #{ENV['
|
270
|
+
puts " #{ENV['ORIGEN_SIM_VCS'] || 'vcs'} #{rtl_top} +incdir+#{Pathname.new(rtl_top).dirname} " + SYNOPSYS_VERDI_SWITCHES.join(' ')
|
228
271
|
puts
|
229
|
-
puts 'Copy the following files (produced by
|
272
|
+
puts 'Copy the following files (produced by vcs) to simulation/<target>/synopsys/. within your Origen application:'
|
230
273
|
puts
|
231
|
-
puts
|
232
|
-
puts '
|
274
|
+
puts ' simv'
|
275
|
+
puts ' simv.daidir'
|
233
276
|
puts
|
234
277
|
puts '-----------------------------------------------------------'
|
235
|
-
puts '
|
278
|
+
puts 'Cadence Incisive (irun)'
|
236
279
|
puts '-----------------------------------------------------------'
|
237
280
|
puts
|
238
281
|
puts 'Add the following to your build script (AND REMOVE ANY OTHER TESTBENCH!):'
|
239
282
|
puts
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
puts ' -CFLAGS "-std=c99" \\'
|
244
|
-
puts ' +vpi \\'
|
245
|
-
puts " #{output_directory}/origen.c \\"
|
246
|
-
puts ' +define+ORIGEN_FSDB=1 \\'
|
247
|
-
puts ' -debug_access+all \\'
|
248
|
-
puts ' +lint=all,noVCDE,noIWU,noVNGS,noCAWM-L,noPORTFRC,noZERO,noNS \\'
|
249
|
-
puts ' -PP \\'
|
250
|
-
puts ' -timescale=1ns/100ps \\'
|
251
|
-
puts ' -full64 \\'
|
252
|
-
puts ' -lca \\'
|
253
|
-
puts ' -kdb \\'
|
283
|
+
CADENCE_SWITCHES.each do |switch|
|
284
|
+
puts " #{switch} \\"
|
285
|
+
end
|
254
286
|
puts
|
255
287
|
puts 'Here is an example which may work for the file you just parsed (add additional -incdir options at the end if required):'
|
256
288
|
puts
|
257
|
-
puts " #{ENV['
|
289
|
+
puts " #{ENV['ORIGEN_SIM_IRUN'] || 'irun'} #{rtl_top} -incdir #{Pathname.new(rtl_top).dirname} " + CADENCE_SWITCHES.join(' ')
|
258
290
|
puts
|
259
|
-
puts 'Copy the following
|
291
|
+
puts 'Copy the following directory (produced by irun) to simulation/<target>/cadence/. within your Origen application:'
|
260
292
|
puts
|
261
|
-
puts '
|
262
|
-
puts ' simv.daidir'
|
293
|
+
puts ' INCA_libs'
|
263
294
|
puts
|
264
295
|
puts '-----------------------------------------------------------'
|
265
296
|
puts
|
@@ -51,6 +51,44 @@ module Origen
|
|
51
51
|
@simulator_value = nil
|
52
52
|
end
|
53
53
|
|
54
|
+
def driver_net
|
55
|
+
@driver_net ||= "#{tester.simulator.testbench_top}.pins.#{rtl_name}"
|
56
|
+
end
|
57
|
+
|
58
|
+
alias_method :_orig_drive, :drive
|
59
|
+
def drive(*args)
|
60
|
+
if _analog_pin_? && simulation_running? && tester.simulator.wreal?
|
61
|
+
tester.poke("#{driver_net}.drive_en", 1)
|
62
|
+
tester.poke("#{driver_net}.drive", args.first + 0.0)
|
63
|
+
else
|
64
|
+
_orig_drive(*args)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
alias_method :write, :drive
|
68
|
+
|
69
|
+
alias_method :_orig_assert, :assert
|
70
|
+
def assert(*args)
|
71
|
+
if _analog_pin_? && simulation_running? && tester.simulator.wreal?
|
72
|
+
drive_enabled = tester.peek("#{driver_net}.drive_en").to_i
|
73
|
+
if drive_enabled == 1
|
74
|
+
tester.poke("#{driver_net}.drive_en", 0)
|
75
|
+
tester.cycle
|
76
|
+
end
|
77
|
+
measured = tester.peek("#{driver_net}.pin", true)
|
78
|
+
# Could implement checking/limits here in future
|
79
|
+
else
|
80
|
+
_orig_assert(*args)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
alias_method :compare, :assert
|
84
|
+
alias_method :expect, :assert
|
85
|
+
alias_method :read, :assert
|
86
|
+
alias_method :measure, :assert
|
87
|
+
|
88
|
+
def _analog_pin_?
|
89
|
+
type == :analog || is_a?(Origen::Pins::PowerPin) || is_a?(Origen::Pins::GroundPin)
|
90
|
+
end
|
91
|
+
|
54
92
|
def apply_force
|
55
93
|
if force
|
56
94
|
simulator.put("2^#{simulation_index}^#{force}")
|
@@ -3,12 +3,17 @@ module Origen
|
|
3
3
|
module TopLevel
|
4
4
|
# Like pins, except removes any pins which have their rtl_name
|
5
5
|
# attribute set to 'nc'
|
6
|
-
|
7
|
-
|
6
|
+
# Optionally pass in a type: option set to either :analog or :digital to
|
7
|
+
# have only the pins with that type returned
|
8
|
+
def rtl_pins(options = {})
|
9
|
+
@rtl_pins ||= {}
|
10
|
+
@rtl_pins[options[:type]] ||= begin
|
11
|
+
opts = options.dup
|
8
12
|
p = []
|
9
13
|
pins.each do |name, pin|
|
10
14
|
options = {}
|
11
|
-
unless pin.rtl_name.to_s.downcase == 'nc'
|
15
|
+
unless pin.rtl_name.to_s.downcase == 'nc' ||
|
16
|
+
(opts[:type] && pin.type && opts[:type] != pin.type)
|
12
17
|
if pin.primary_group
|
13
18
|
options[:group] = true
|
14
19
|
end
|
@@ -78,7 +78,7 @@ module OrigenSim
|
|
78
78
|
if Origen.debugger_enabled?
|
79
79
|
Origen.log.error 'The simulation failed to get underway!'
|
80
80
|
else
|
81
|
-
Origen.log.error 'The simulation failed to get underway! (run again with -
|
81
|
+
Origen.log.error 'The simulation failed to get underway! (run again with -verbose to see why)'
|
82
82
|
end
|
83
83
|
else
|
84
84
|
if in_progress
|
@@ -63,7 +63,6 @@ module OrigenSim
|
|
63
63
|
# to be defined. This should be a comma-separeted string of the available values.
|
64
64
|
# It will be assumed that each details will be defined in the snapshot.
|
65
65
|
def fetch
|
66
|
-
puts 'FETCHING!'.cyan
|
67
66
|
# Read the available details.
|
68
67
|
# names = str_peek("#{debug_module}.PARAMETER_NAMES").split(',')
|
69
68
|
names = @simulator.peek_str(detail_names_net)
|