1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972
|
/*
* Simulator of microcontrollers (sim.src/simif.cc)
*
* Copyright (C) 2016,16 Drotos Daniel, Talker Bt.
*
* To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
*
*/
/* This file is part of microcontroller simulator: ucsim.
UCSIM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
UCSIM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UCSIM; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/*@1@*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "i_string.h"
// prj
#include "globals.h"
// sim
#include "simcl.h"
#include "simifcl.h"
/* Interface command */
cl_sif_command::cl_sif_command(enum sif_command cmd,
const char *the_name,
const char *the_description,
enum sif_answer_type the_answer_type,
int the_params_needed,
class cl_simulator_interface *the_sif):
cl_base()
{
command= cmd;
set_name(the_name);
description= strdup(the_description);
answer_type= the_answer_type;
sif= the_sif;
parameters= 0;
answer= 0;
params_needed= the_params_needed;
nuof_params= params_received= 0;
answer_length= answered_bytes= 0;
answering= false;
}
cl_sif_command::~cl_sif_command(void)
{
if (description)
free(description);
clear_params();
clear_answer();
}
int
cl_sif_command::init(void)
{
clear_params();
clear_answer();
return(0);
}
void
cl_sif_command::clear_params(void)
{
nuof_params= 0;
params_received= 0;
if (parameters)
free(parameters);
}
void
cl_sif_command::clear_answer(void)
{
answer_length= 0;
answered_bytes= 0;
if (answer)
free(answer);
answer= 0;
}
void
cl_sif_command::clear(void)
{
clear_params();
clear_answer();
}
bool
cl_sif_command::get_parameter(int nr, t_mem *into)
{
if (!parameters ||
nr >= nuof_params)
return(false);
if (into)
*into= parameters[nr];
return(true);
}
t_mem
cl_sif_command::read(class cl_memory_cell *cel)
{
t_mem ret= cel->get();
if (answering &&
answer)
{
if (answered_bytes < answer_length)
{
ret= answer[answered_bytes];
answered_bytes++;
}
if (answered_bytes >= answer_length)
{
sif->finish_command();
}
}
return(ret);
}
void
cl_sif_command::write(class cl_memory_cell *cel, t_mem *val)
{
if (nuof_params &&
params_received < nuof_params &&
parameters)
{
parameters[params_received]= *val;
params_received++;
if (params_received >= nuof_params)
{
produce_answer();
start_answer();
}
}
}
void
cl_sif_command::start(void)
{
need_params(params_needed);
}
void
cl_sif_command::need_params(int nr)
{
clear_params();
if (nr <= 0)
{
produce_answer();
start_answer();
}
nuof_params= nr;
params_received= 0;
parameters= (t_mem *)calloc(nr, sizeof(t_mem));
}
void
cl_sif_command::produce_answer(void)
{
clear_answer();
}
void
cl_sif_command::set_answer(t_mem ans)
{
clear_answer();
answer= (t_mem *)calloc(1, sizeof(t_mem));
answer[0]= ans;
answer_length= 1;
}
void
cl_sif_command::set_answer(int nr, t_mem ans[])
{
clear_answer();
answer= (t_mem *)calloc(nr+1, sizeof(t_mem));
answer[0]= nr;
int i;
for (i= 0; i < nr; i++)
answer[i+1]= ans[i];
answer_length= nr+1;
}
void
cl_sif_command::set_answer(const char *ans)
{
clear_answer();
if (ans &&
*ans)
{
answer= (t_mem *)calloc(strlen(ans)+2, sizeof(t_mem));
int i= 0;
answer[0]= strlen(ans)+1;
while (ans[i])
{
answer[i+1]= ans[i];
i++;
}
answer[i+1]= '\0';
answer_length= i+2;
}
}
void
cl_sif_command::start_answer(void)
{
if (answer_length)
answering= true;
else
{
answering= false;
sif->finish_command();
}
}
/* Command: get info about commands */
void
cl_sif_commands::produce_answer(void)
{
int c, i;
if (!sif)
return;
c= sif->commands->count;
answer= (t_mem*)calloc(c+1, sizeof(t_mem));
answer[0]= c;
for (i= 0; i < c; i++)
{
answer[i+1]= 0;
class cl_sif_command *sc=
dynamic_cast<class cl_sif_command *>(sif->commands->object_at(i));
if (!sc)
continue;
answer[i+1]= sc->get_command();
}
answer_length= c+1;
}
/* Command: get info about a command */
void
cl_sif_cmdinfo::produce_answer(void)
{
int i;
if (!sif)
return;
t_mem cm;
if (!get_parameter(0, &cm))
return;
answer= (t_mem*)calloc(1+2, sizeof(t_mem));
answer[0]= 2;
class cl_sif_command *about= 0;
for (i= 0; i < sif->commands->count; i++)
{
class cl_sif_command *sc=
dynamic_cast<class cl_sif_command *>(sif->commands->object_at(i));
if (sc->get_command() == (enum sif_command)cm)
{
about= sc;
break;
}
}
if (about)
{
answer[1]= about->get_params_needed();
answer[2]= about->get_answer_type();
}
answer_length= 3;
}
/* Command: get help about a command */
void
cl_sif_cmdhelp::produce_answer(void)
{
int i;
if (!sif)
return;
t_mem cm;
if (!get_parameter(0, &cm))
return;
class cl_sif_command *about= 0;
for (i= 0; i < sif->commands->count; i++)
{
class cl_sif_command *sc=
dynamic_cast<class cl_sif_command *>(sif->commands->object_at(i));
if (sc->get_command() == (enum sif_command)cm)
{
about= sc;
break;
}
}
if (about)
set_answer(about->get_description());
else
set_answer((t_mem)0);
}
/* Command: stop simulation */
void
cl_sif_stop::produce_answer(void)
{
class cl_sim *sim= 0;
if (sif)
if (sif->uc)
sim= sif->uc->sim;
set_answer(SIFCM_STOP);
if (sim)
sim->stop(resSIMIF);
}
/* Command: print character */
void
cl_sif_print::produce_answer(void)
{
t_mem cm;
if (get_parameter(0, &cm))
{
//printf("** SIF_PRINT 0x%02x,'%c'\n", cm, cm);
putchar(cm);
fflush(stdout);
}
if (sif)
sif->finish_command();
}
/* Command: print character in hex */
void
cl_sif_hex::produce_answer(void)
{
t_mem cm;
if (get_parameter(0, &cm))
{
//printf("** SIF_HEX 0x%02x,'%c'\n", cm, cm);
printf("%02x", cm);
fflush(stdout);
}
if (sif)
sif->finish_command();
}
/* Command: write character to output file */
void
cl_sif_write::produce_answer(void)
{
t_mem cm;
if (sif)
{
if (get_parameter(0, &cm))
{
if (sif->fout)
{
char c= cm;
sif->fout->write(&c, 1);
}
}
}
if (sif)
sif->finish_command();
}
/* Command: check input file */
void
cl_sif_fin_check::produce_answer(void)
{
int i= 0;
if (sif)
{
if (sif->fin)
{
i= sif->fin->input_avail();
if (i)
{
if (sif->fin->eof())
i= 0;
}
i= i?1:0;
}
}
set_answer(i);
answer_length= 1;
}
/* Command: read from input file */
void
cl_sif_read::produce_answer(void)
{
int i= 0;
if (sif)
{
if (sif->fin)
{
int c;
if (sif->fin->input_avail())
{
i= sif->fin->read(&c, 1);
if (i != 0)
i= c;
}
}
}
set_answer(i);
answer_length= 1;
}
/* Command: reset */
void
cl_sif_reset::produce_answer(void)
{
if (sif)
{
if (sif->uc)
sif->uc->reset();
sif->finish_command();
}
}
/*
* Virtual HW: simulator interface
*/
cl_simulator_interface::cl_simulator_interface(class cl_uc *auc):
cl_hw(auc, HW_SIMIF, 0, "simif")
{
version= 1;
as_name= NULL;
addr= 0;
commands= new cl_list(2, 2, "sif_commands");
active_command= 0;
}
cl_simulator_interface::~cl_simulator_interface(void)
{
if (as_name)
free((void*)as_name);
delete commands;
}
int
cl_simulator_interface::init(void)
{
cl_option *oas= application->options->get_option("simif_memory");
cl_option *oa = application->options->get_option("simif_address");
char *oas_v;
long oa_v;
cl_hw::init();
fin= fout= NULL;
if (oas &&
oa)
{
oas->get_value(&oas_v);
oa->get_value(&oa_v);
if (oas_v &&
(strlen(oas_v) > 0))
{
if (as_name)
free((void*)as_name);
as_name= strdup(oas_v);
addr= oa_v;
}
}
if (as_name)
{
as= uc->address_space(as_name);
if (as)
{
address= addr;
if (addr < 0)
address= as->highest_valid_address();
cell= register_cell(as, address);
}
else
fprintf(stderr, "Simif: %s is not a valid address space name\n", as_name);
}
else
{
as= NULL;
cell= NULL;
}
class cl_option *fo= application->options->get_option("simif_infile");
char *s;
if (fo)
{
fo->get_value(&s);
if (s &&
(strlen(s) > 0))
fin= mk_io(s, "r");
}
fo= application->options->get_option("simif_outfile");
if (fo)
{
fo->get_value(&s);
if (s &&
(strlen(s) > 0))
fout= mk_io(s, "w");
}
class cl_sif_command *c;
commands->add(c= new cl_sif_detect(this));
c->init();
commands->add(c= new cl_sif_commands(this));
c->init();
commands->add(c= new cl_sif_ifver(this));
c->init();
commands->add(c= new cl_sif_simver(this));
c->init();
commands->add(c= new cl_sif_ifreset(this));
c->init();
commands->add(c= new cl_sif_cmdinfo(this));
c->init();
commands->add(c= new cl_sif_cmdhelp(this));
c->init();
commands->add(c= new cl_sif_stop(this));
c->init();
commands->add(c= new cl_sif_print(this));
c->init();
commands->add(c= new cl_sif_hex(this));
c->init();
commands->add(c= new cl_sif_fin_check(this));
c->init();
commands->add(c= new cl_sif_read(this));
c->init();
commands->add(c= new cl_sif_write(this));
c->init();
cl_var *v;
uc->vars->add(v= new cl_var(cchars("simif_on"), cfg, simif_on,
cfg_help(simif_on)));
v->init();
cfg_set(simif_on, 1);
uc->vars->add(v= new cl_var(cchars("sim_run"), cfg, simif_run,
cfg_help(simif_run)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_start"), cfg, simif_start,
cfg_help(simif_start)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_stop"), cfg, simif_stop,
cfg_help(simif_stop)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_quit"), cfg, simif_quit,
cfg_help(simif_quit)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_reason"), cfg, simif_reason,
cfg_help(simif_reason)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_xtal"), cfg, simif_xtal,
cfg_help(simif_xtal)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_ticks"), cfg, simif_ticks,
cfg_help(simif_ticks)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_isr_ticks"), cfg, simif_isr_ticks,
cfg_help(simif_isr_ticks)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_idle_ticks"), cfg, simif_idle_ticks,
cfg_help(simif_idle_ticks)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_real_time"), cfg, simif_real_time,
cfg_help(simif_real_time)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_vclk"), cfg, simif_vclk,
cfg_help(simif_vclk)));
v->init();
uc->vars->add(v= new cl_var(cchars("PC"), cfg, simif_pc,
cfg_help(simif_pc)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_print"), cfg, simif_print,
cfg_help(simif_print)));
v->init();
uc->vars->add(v= new cl_var(cchars("sim_write"), cfg, simif_write,
cfg_help(simif_write)));
v->init();
return(0);
}
char *
cl_simulator_interface::cfg_help(t_addr addr)
{
switch (addr)
{
case simif_on : return (char*)"Turn simif on/off (bool, RW)";
case simif_run : return (char*)"WR: sets running state, RD: check if simulation is running";
case simif_start : return (char*)"WR: start simulation, RD: true if running";
case simif_stop : return (char*)"WR: stop simulation, RD: true if stopped";
case simif_quit : return (char*)"Quit simulator (any, WO)";
case simif_reason : return (char*)"Reason of last stop (int, RO)";
case simif_xtal : return (char*)"Xtal frequency in Hz (int, RW)";
case simif_ticks : return (char*)"Nuof ticks simulated so far (int, RO)";
case simif_isr_ticks: return (char*)"Ticks spent in ISR (int, RO)";
case simif_idle_ticks:return (char*)"Ticks spent in idle state (int, RO)";
case simif_real_time: return (char*)"Real time since reset in msec (int, RO)";
case simif_vclk : return (char*)"Nuof simulated virtual clocks (int, RO)";
case simif_pc : return (char*)"PC register (int, RW)";
case simif_print : return (char*)"Print char on stdout (int, WO)";
case simif_write : return (char*)"Write char to simif output (int, WO)";
}
return (char*)"Not used";
}
void
cl_simulator_interface::set_cmd(class cl_cmdline *cmdline,
class cl_console_base *con)
{
class cl_cmd_arg *params[2]= {
cmdline->param(0),
cmdline->param(1)
};
if (cmdline->syntax_match(uc, MEMORY ADDRESS))
{
class cl_memory *mem= params[0]->value.memory.memory;
t_addr a= params[1]->value.address;
if (!mem->is_address_space())
{
con->dd_printf("%s is not an address space\n");
return;
}
if (!mem->valid_address(a))
{
con->dd_printf("Address must be between 0x%x and 0x%x\n",
AU(mem->lowest_valid_address()),
AU(mem->highest_valid_address()));
return;
}
as_name= strdup((char*)mem->get_name());
addr= a;
if ((as= dynamic_cast<class cl_address_space *>(mem)) != 0)
{
address= addr;
if (addr < 0)
address= as->highest_valid_address();
if (cell != NULL)
unregister_cell(cell);
cell= register_cell(as, address);
}
}
else if (cmdline->syntax_match(uc, STRING STRING))
{
char *p1= params[0]->value.string.string;
char *p2= params[1]->value.string.string;
if (strcmp(p1, "fout") == 0)
{
if (fout)
delete fout;
fout= 0;
if ((strcmp(p2, "NULL") != 0) &&
(strcmp(p2, "(NULL)") != 0))
{
fout= mk_io(p2, "w");
}
}
else if (strcmp(p1, "fin") == 0)
{
if (fin)
delete fin;
fin= 0;
if ((strcmp(p2, "NULL") != 0) &&
(strcmp(p2, "(NULL)") != 0))
{
fin= mk_io(p2, "r");
}
}
}
else
{
con->dd_printf("set hardware simif memory address\n");
con->dd_printf("set hardware simif fin \"input_file_name\"\n");
con->dd_printf("set hardware simif fout \"output_file_name\"\n");
}
}
t_mem
cl_simulator_interface::read(class cl_memory_cell *cel)
{
if (conf(cel, NULL))
return cel->get();
if (!active_command)
{
t_mem d= cel->get();
return(~d & cel->get_mask());
}
else
{
t_mem ret= active_command->read(cel);
return(ret);
}
return(cel->get());
}
void
cl_simulator_interface::write(class cl_memory_cell *cel, t_mem *val)
{
if (conf(cel, val))
return;
if (!active_command)
{
int i;
for (i= 0; i < commands->count; i++)
{
class cl_sif_command *c=
dynamic_cast<class cl_sif_command *>(commands->object_at(i));
if (!c)
continue;
enum sif_command cm= c->get_command();
if ((enum sif_command)(*val) == cm)
{
active_command= c;
c->start();
return;
}
}
}
else
{
active_command->write(cel, val);
}
}
t_mem
cl_simulator_interface::conf_op(cl_memory_cell *cell, t_addr addr, t_mem *val)
{
switch ((enum simif_cfg)addr)
{
case simif_on: // turn this HW on/off
if (val)
{
if (*val)
on= true;
else
on= false;
}
else
{
cell->set(on?1:0);
}
break;
case simif_run: // simulator running: true= run, false= stop
if (val)
{
if (*val)
{
uc->sim->start(0, 0), *val= 1;
}
else
uc->sim->stop(resSIMIF), *val= 0;
}
else
{
int i= uc->sim->state;
i= i & SIM_GO;
cell->set(i?1:0);
}
break;
case simif_start: // start simulation
if (val)
uc->sim->start(0, 0), *val= 1;
else
{
int i= uc->sim->state;
i= i & SIM_GO;
cell->set(i?1:0);
}
break;
case simif_stop: // stop simulation
if (val)
uc->sim->stop(resSIMIF), *val= 1;
else
{
int i= uc->sim->state;
i= i & SIM_GO;
cell->set((!i)?1:0);
}
break;
case simif_quit: // quit
if (val)
uc->sim->state|= SIM_QUIT;
break;
case simif_reason: // reason of last stop
if (val)
*val= cell->get();
break;
case simif_xtal: // xtal frequ
if (val)
uc->xtal= *val;
cell->set(uc->xtal);
break;
case simif_ticks: // tick counter
if (val)
*val= cell->get();
cell->set(uc->ticks->ticks);
break;
case simif_isr_ticks: // isr tick counter
if (val)
*val= cell->get();
cell->set(uc->isr_ticks->ticks);
break;
case simif_idle_ticks: // idle tick counter
if (val)
*val= cell->get();
cell->set(uc->idle_ticks->ticks);
break;
case simif_real_time: // real time in msec
if (val)
*val= cell->get();
cell->set(uc->get_rtime() * 1000);
break;
case simif_vclk: // virtual clock
if (val)
*val= cell->get();
cell->set(uc->vc.fetch + uc->vc.rd + uc->vc.wr);
break;
case simif_pc: // PC of uc
if (val)
{
t_addr addr= *val;
class cl_address_space *rom= uc->rom;
if (rom)
{
if (addr > rom->highest_valid_address())
addr= rom->highest_valid_address();
}
uc->PC= addr;
}
cell->set(uc->PC);
break;
case simif_print:
if (val)
{
printf("%c", (char)(*val&0xff));
fflush(stdout);
}
break;
case simif_write:
if (val)
{
char c= *val & 0xff;
if (fout)
fout->write(&c, 1);
}
break;
case simif_nuof:
break;
}
return cell->get();
}
void
cl_simulator_interface::finish_command(void)
{
if (active_command)
{
active_command->clear_answer();
}
active_command= 0;
}
void
cl_simulator_interface::print_info(class cl_console_base *con)
{
con->dd_printf("uCsim simulator interface, version %d, ", version);
con->dd_printf("at %s[", as_name);
if (as)
con->dd_printf(as->addr_format, address);
else
con->dd_printf("0x%x", AU(address));
con->dd_printf("]\n");
con->dd_printf("Active command: ");
if (!active_command)
con->dd_printf("none.\n");
else
{
class cl_sif_command *c= active_command;
con->dd_printf("0x%02x %s %s\n", c->get_command(),
c->get_name(), c->get_description());
con->dd_printf("Parameters received %d bytes of %d\n",
c->get_params_received(), c->get_nuof_params());
if (c->get_nuof_params())
{
con->dd_printf(" ");
int i;
for (i= 0; i < c->get_nuof_params(); i++)
{
t_mem p;
if (c->get_parameter(i, &p))
con->dd_printf(" %02x", MU8(p));
else
con->dd_printf(" --");
}
con->dd_printf("\n");
}
con->dd_printf("Answered %d bytes of %d\n",
c->get_answered_bytes(), c->get_answer_length());
con->dd_printf("Answering: %s\n", (c->get_answering())?"yes":"no");
}
int i;
con->dd_printf("Known commands:\n");
for (i= 0; i < commands->count; i++)
{
class cl_sif_command *c=
dynamic_cast<class cl_sif_command *>(commands->object_at(i));
if (!c)
continue;
int cmd= c->get_command();
con->dd_printf("0x%02x/%c %s: %s\n", cmd,
isprint(cmd)?cmd:' ',
c->get_name(), c->get_description());
}
con->dd_printf("Input file: ");
if (fin)
con->dd_printf("%s", fin->get_file_name());
con->dd_printf("\n");
con->dd_printf("Output file: ");
if (fout)
con->dd_printf("%s", fout->get_file_name());
con->dd_printf("\n");
print_cfg_info(con);
}
/* End of sim.src/simif.cc */
|