Skip to content

Commit 1558932

Browse files
.....
1 parent 0d75e28 commit 1558932

8 files changed

Lines changed: 172 additions & 83 deletions

src/vhdl/tb_base_pkg.vhd

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ package tb_base_pkg is
185185
);
186186

187187
type stm_inst_initial_context is record
188+
is_var_declaration : boolean;
188189
code_section : stm_code_section;
189190
namespace_name : text_field;
190191
proc_name : text_field;
@@ -288,10 +289,15 @@ package tb_base_pkg is
288289
variable slc : in src_locator;
289290
variable insts : inout inst_sequence;
290291
variable inst : text_field;
291-
variable par_text_fields : in parameter_text_field_array;
292-
variable str_ptr : in stm_text_ptr;
293-
variable txt_enclosing_quote : in character;
294-
constant debug : boolean
292+
variable ia: inst_arguments;
293+
variable debug : boolean
294+
);
295+
296+
procedure append_code_file(
297+
variable slc : src_locator;
298+
variable code_files : inout file_def_list;
299+
constant stimulus_path : in string;
300+
variable stimulus_file : in string
295301
);
296302

297303
function combine_to_absolute_file_name(

src/vhdl/tb_base_pkg_body.vhd

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ package body tb_base_pkg is
103103
variable iic : inout stm_inst_initial_context
104104
) is
105105
begin
106+
iic.is_var_declaration := false;
106107
iic.code_section := NONE;
107108
iic.namespace_name := (others => nul);
108109
iic.proc_name := (others => nul);
@@ -130,10 +131,8 @@ package body tb_base_pkg is
130131
variable slc : in src_locator;
131132
variable insts : inout inst_sequence;
132133
variable inst : text_field;
133-
variable par_text_fields : in parameter_text_field_array;
134-
variable str_ptr : in stm_text_ptr;
135-
variable txt_enclosing_quote : in character;
136-
constant debug : boolean
134+
variable ia: inst_arguments;
135+
variable debug : boolean
137136
)
138137
is
139138
variable nen : integer;
@@ -143,9 +142,7 @@ package body tb_base_pkg is
143142
ne_ptr := new inst_element;
144143
ne_ptr.slc := slc;
145144
ne_ptr.inst := inst;
146-
ne_ptr.inst_args.par_text_fields := par_text_fields;
147-
ne_ptr.inst_args.txt := str_ptr;
148-
ne_ptr.inst_args.txt_enclosing_quote := txt_enclosing_quote;
145+
ne_ptr.inst_args := ia;
149146
insts.element_ptrs(nen) := ne_ptr;
150147
insts.last_element_num := nen;
151148
if debug then

src/vhdl/tb_instructions_pkg.vhd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ package tb_instructions_pkg is
9090

9191
-- signals
9292
constant INSTR_SIGNAL : string := "signal";
93+
constant INSTR_SIGNAL_PAR_CLOSE : string := "var_)";
9394
constant INSTR_SIGNAL_READ : string := "signal_read";
9495
constant INSTR_SIGNAL_VERIFY : string := "signal_verify";
9596
constant INSTR_SIGNAL_WRITE : string := "signal_write";
@@ -100,6 +101,7 @@ package tb_instructions_pkg is
100101

101102
-- bus
102103
constant INSTR_BUS : string := "bus";
104+
constant INSTR_BUS_PAR_CLOSE : string := "var_)";
103105
constant INSTR_BUS_READ : string := "bus_read";
104106
constant INSTR_BUS_VERIFY : string := "bus_verify";
105107
constant INSTR_BUS_WRITE : string := "bus_write";
@@ -112,6 +114,7 @@ package tb_instructions_pkg is
112114

113115
-- file
114116
constant INSTR_FILE : string := "file";
117+
constant INSTR_FILE_PAR_CLOSE : string := "var_)";
115118
constant INSTR_FILE_READABLE : string := "file_readable";
116119
constant INSTR_FILE_WRITABLE : string := "file_writable";
117120
constant INSTR_FILE_APPENDABLE : string := "file_appendable";
@@ -125,6 +128,7 @@ package tb_instructions_pkg is
125128

126129
-- label
127130
constant INSTR_LABEL : string := "label";
131+
constant INSTR_LABEL_PAR_CLOSE : string := "var_)";
128132
constant INSTR_LABEL_POINTER_COPY : string := "label_pointer_copy";
129133
constant INSTR_LABEL_POINTER_COPY_PAR_CLOSE : string := "label_pointer_copy_)";
130134
constant INSTR_LABEL_EQU : string := "label_equ";
@@ -134,6 +138,7 @@ package tb_instructions_pkg is
134138

135139
-- lines
136140
constant INSTR_LINES : string := "lines";
141+
constant INSTR_LINES_PAR_CLOSE : string := "var_)";
137142
constant INSTR_LINES_GET_ARRAY : string := "lines_get_array";
138143
constant INSTR_LINES_SET_ARRAY : string := "lines_set_array";
139144
constant INSTR_LINES_SET_MESSAGE : string := "lines_set_message";
@@ -149,6 +154,7 @@ package tb_instructions_pkg is
149154

150155
-- array
151156
constant INSTR_ARRAY : string := "array";
157+
constant INSTR_ARRAY_PAR_CLOSE : string := "var_)";
152158
constant INSTR_ARRAY_GET : string := "array_get";
153159
constant INSTR_ARRAY_SET : string := "array_set";
154160
constant INSTR_ARRAY_SIZE : string := "array_size";

src/vhdl/tb_instructions_pkg_body.vhd

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ package body tb_instructions_pkg is
7171
append_inst_def(inst_defs, INSTR_INCLUDE, 1);
7272
append_inst_def(inst_defs, INSTR_LOOP, 1);
7373
append_inst_def(inst_defs, INSTR_VAR, 2);
74+
append_inst_def(inst_defs, INSTR_VAR_PAR_CLOSE, 2);
7475
-- variable
7576
append_inst_def(inst_defs, INSTR_VAR_VERIFY, 3);
7677
append_inst_def(inst_defs, INSTR_ADD, 2);
@@ -91,6 +92,7 @@ package body tb_instructions_pkg is
9192
append_inst_def(inst_defs, INSTR_LD, 1);
9293
-- signal
9394
append_inst_def(inst_defs, INSTR_SIGNAL, 2);
95+
append_inst_def(inst_defs, INSTR_SIGNAL_PAR_CLOSE, 2);
9496
append_inst_def(inst_defs, INSTR_SIGNAL_READ, 2);
9597
append_inst_def(inst_defs, INSTR_SIGNAL_VERIFY, 4);
9698
append_inst_def(inst_defs, INSTR_SIGNAL_WRITE, 2);
@@ -100,6 +102,7 @@ package body tb_instructions_pkg is
100102
append_inst_def(inst_defs, INSTR_SIGNAL_POINTER_GET, 2);
101103
-- bus
102104
append_inst_def(inst_defs, INSTR_BUS, 2);
105+
append_inst_def(inst_defs, INSTR_BUS_PAR_CLOSE, 2);
103106
append_inst_def(inst_defs, INSTR_BUS_READ, 4);
104107
append_inst_def(inst_defs, INSTR_BUS_VERIFY, 6);
105108
append_inst_def(inst_defs, INSTR_BUS_WRITE, 4);
@@ -111,6 +114,7 @@ package body tb_instructions_pkg is
111114
append_inst_def(inst_defs, INSTR_BUS_POINTER_GET, 2);
112115
-- file
113116
append_inst_def(inst_defs, INSTR_FILE, 1);
117+
append_inst_def(inst_defs, INSTR_FILE_PAR_CLOSE, 1);
114118
append_inst_def(inst_defs, INSTR_FILE_READABLE, 2);
115119
append_inst_def(inst_defs, INSTR_FILE_WRITABLE, 2);
116120
append_inst_def(inst_defs, INSTR_FILE_APPENDABLE, 2);
@@ -123,6 +127,7 @@ package body tb_instructions_pkg is
123127
append_inst_def(inst_defs, INSTR_FILE_POINTER_COPY_PAR_CLOSE, 2);
124128
-- label
125129
append_inst_def(inst_defs, INSTR_LABEL, 2);
130+
append_inst_def(inst_defs, INSTR_LABEL_PAR_CLOSE, 2);
126131
append_inst_def(inst_defs, INSTR_LABEL_POINTER_COPY, 2);
127132
append_inst_def(inst_defs, INSTR_LABEL_POINTER_COPY_PAR_CLOSE, 2);
128133
append_inst_def(inst_defs, INSTR_LABEL_EQU, 2);
@@ -131,6 +136,7 @@ package body tb_instructions_pkg is
131136
append_inst_def(inst_defs, INSTR_LABEL_SET_PAR_CLOSE, 2);
132137
-- lines
133138
append_inst_def(inst_defs, INSTR_LINES, 1);
139+
append_inst_def(inst_defs, INSTR_LINES_PAR_CLOSE, 1);
134140
append_inst_def(inst_defs, INSTR_LINES_GET_ARRAY, 4);
135141
append_inst_def(inst_defs, INSTR_LINES_SET_ARRAY, 3);
136142
append_inst_def(inst_defs, INSTR_LINES_SET_MESSAGE, 2);
@@ -145,6 +151,7 @@ package body tb_instructions_pkg is
145151
append_inst_def(inst_defs, INSTR_LINES_POINTER_COPY_PAR_CLOSE, 2);
146152
-- array
147153
append_inst_def(inst_defs, INSTR_ARRAY, 2);
154+
append_inst_def(inst_defs, INSTR_ARRAY_PAR_CLOSE, 2);
148155
append_inst_def(inst_defs, INSTR_ARRAY_GET, 3);
149156
append_inst_def(inst_defs, INSTR_ARRAY_SET, 3);
150157
append_inst_def(inst_defs, INSTR_ARRAY_SIZE, 2);
@@ -272,7 +279,10 @@ package body tb_instructions_pkg is
272279
end if;
273280
elsif itokens(1)(1 to 4) = "file" then
274281
token1_len := 4;
275-
if itokens(2)(1 to 8) = "readable" then
282+
if itokens(3)(1 to 1) = ")" then
283+
token3_len := 1;
284+
token_merge := 13;
285+
elsif itokens(2)(1 to 8) = "readable" then
276286
token2_len := 8;
277287
token_merge := 12;
278288
elsif itokens(2)(1 to 8) = "writable" then
@@ -312,7 +322,10 @@ package body tb_instructions_pkg is
312322
end if;
313323
elsif itokens(1)(1 to 5) = "label" then
314324
token1_len := 5;
315-
if itokens(2)(1 to 3) = "equ" then
325+
if itokens(3)(1 to 1) = ")" then
326+
token3_len := 1;
327+
token_merge := 13;
328+
elsif itokens(2)(1 to 3) = "equ" then
316329
token2_len := 3;
317330
token_merge := 12;
318331
if itokens(3)(1 to 1) = ")" then
@@ -341,7 +354,10 @@ package body tb_instructions_pkg is
341354
end if;
342355
elsif itokens(1)(1 to 5) = "lines" then
343356
token1_len := 5;
344-
if itokens(2)(1 to 3) = "get" then
357+
if itokens(3)(1 to 1) = ")" then
358+
token3_len := 1;
359+
token_merge := 13;
360+
elsif itokens(2)(1 to 3) = "get" then
345361
token2_len := 3;
346362
token_merge := 12;
347363
if itokens(3)(1 to 5) = "array" then
@@ -403,7 +419,10 @@ package body tb_instructions_pkg is
403419
end if;
404420
elsif itokens(1)(1 to 5) = "array" then
405421
token1_len := 5;
406-
if itokens(2)(1 to 3) = "set" then
422+
if itokens(3)(1 to 1) = ")" then
423+
token3_len := 1;
424+
token_merge := 13;
425+
elsif itokens(2)(1 to 3) = "set" then
407426
token2_len := 3;
408427
token_merge := 12;
409428
elsif itokens(2)(1 to 3) = "get" then
@@ -436,7 +455,10 @@ package body tb_instructions_pkg is
436455
end if;
437456
elsif itokens(1)(1 to 3) = "var" then
438457
token1_len := 3;
439-
if itokens(2)(1 to 6) = "verify" then
458+
if itokens(3)(1 to 1) = ")" then
459+
token3_len := 1;
460+
token_merge := 13;
461+
elsif itokens(2)(1 to 6) = "verify" then
440462
token2_len := 6;
441463
token_merge := 12;
442464
elsif itokens(2)(1 to 7) = "pointer" then
@@ -453,7 +475,10 @@ package body tb_instructions_pkg is
453475
end if;
454476
elsif itokens(1)(1 to 6) = "signal" then
455477
token1_len := 6;
456-
if itokens(2)(1 to 6) = "verify" then
478+
if itokens(3)(1 to 1) = ")" then
479+
token3_len := 1;
480+
token_merge := 13;
481+
elsif itokens(2)(1 to 6) = "verify" then
457482
token2_len := 6;
458483
token_merge := 12;
459484
elsif itokens(2)(1 to 4) = "read" then
@@ -483,7 +508,10 @@ package body tb_instructions_pkg is
483508
end if;
484509
elsif itokens(1)(1 to 3) = "bus" then
485510
token1_len := 3;
486-
if itokens(2)(1 to 6) = "verify" then
511+
if itokens(3)(1 to 1) = ")" then
512+
token3_len := 1;
513+
token_merge := 13;
514+
elsif itokens(2)(1 to 6) = "verify" then
487515
token2_len := 6;
488516
token_merge := 12;
489517
elsif itokens(2)(1 to 4) = "read" then

src/vhdl/tb_interpreter_pkg.vhd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ package tb_interpreter_pkg is
6161
variable code_files : in file_def_list;
6262
variable inst_defs : in inst_def_list;
6363
variable vars : inout var_pool_ordered;
64-
variable machine_value_width : integer;
64+
constant machine_value_width : integer;
6565
constant debug : boolean
6666
);
6767

6868
procedure parse_variables(
6969
variable code_files : in file_def_list;
7070
variable inst_defs : in inst_def_list;
7171
variable vars : inout var_pool_ordered;
72-
variable machine_value_width : in integer;
72+
constant machine_value_width : in integer;
7373
constant debug : boolean
7474
);
7575

@@ -78,7 +78,7 @@ package tb_interpreter_pkg is
7878
variable inst_defs : in inst_def_list;
7979
variable insts : inout inst_sequence;
8080
variable procs : inout proc_pool_ordered;
81-
variable machine_value_width : integer;
81+
constant machine_value_width : integer;
8282
constant debug : boolean
8383
);
8484

0 commit comments

Comments
 (0)