+2003-06-10 Dave Brolley <brolley@redhat.com>
+
+ * mainDynamic.cxx (usage): Document --ulog-* options.
+ (try_add_memory): Don't make the base of the mapping zero by default.
+ (Defs): New members: ulog_level, ulog_mode, ulog_file.
+ (option_num): New members: opt_ulog_level, opt_ulog_mode,
+ opt_ulog_file.
+ (long_options): Add ulog-*.
+ (main): Provide defaults for ulog-*. Handle opt_ulog_*.
+ * commonCfg.h (struct UlogCfg): New struct.
+ (SessionCfg): Now inherits UlogCfg.
+ (add_ulog_file): New method of SessionCfg.
+ (ulog_map): New member of SessionCfg.
+ (BoardCfg): Now inherits UlogCfg.
+ * commonCfg.cxx (SessionCfg): Add a ulog mapping for "-" to ulog_map.
+ (add_ulog_file): New method of SeessionCfg.
+ (BoardCfg): Initialize UlogCfg.
+ (add_memory): Set the base for the mapping to 0.
+
2003-04-16 Dave Brolley <brolley@redhat.com>
* commonCfg.cxx (final_insn_count): Set cpu attribute 'final-insn-count'.
conn_pin (main_obj, "stopping", shutdown_seq, "input");
yield_net->add_output (0, host_sched, "yield");
init_seq->add_output (0, reset_net, "input");
+
+ AtomicCfg *ulog = new AtomicCfg ("ulog-*",
+ "libconsoles.la",
+ "console_component_library",
+ "sid-io-stdio");
+ ulog_map["*"] = ulog;
+ add_child (ulog);
+}
+
+void
+SessionCfg::add_ulog_file (const string name)
+{
+ if (ulog_map.find (name) != ulog_map.end ())
+ return; // already there
+
+ // There is no existing logger for this file, so add a new one.
+ AtomicCfg *ulog = new AtomicCfg ("ulog-" + name,
+ "libconsoles.la",
+ "console_component_library",
+ "sid-io-stdio");
+ set (ulog, "filename", name);
+ ulog_map[name] = ulog;
+ add_child (ulog);
}
void SessionCfg::use_no_stdio ()
bool with_cpu_main_mem_connect) :
ComponentCfg (name),
AggregateCfg (name),
+ UlogCfg (),
cache_flush_net (NULL),
z_packet (with_z_packet),
sess (s),
void BoardCfg::add_memory (const Mapping &m)
{
if (main_mapper)
- main_mapper->map (m);
+ {
+ Mapping map(m);
+ main_mapper->map (map.base(0));
+ }
}
int n;
};
+// Configs which support logging should inherit this
+struct UlogCfg
+{
+ UlogCfg (sid::host_int_4 l = 0, const string m = "less", const string f = "-")
+ : ulog_level (l), ulog_mode (m), ulog_file (f)
+ {}
+ virtual void set_ulog_level (sid::host_int_4 l) { ulog_level = l; }
+ virtual void set_ulog_mode (const string m) { ulog_mode = m; }
+ virtual void set_ulog_file (const string f) { ulog_file = f; }
+ sid::host_int_4 ulog_level;
+ string ulog_mode;
+ string ulog_file;
+};
+
// you should really only make one of these, with an empty name,
// unless you want some crazy multi-session support.
struct SessionCfg :
- virtual public AggregateCfg
+ virtual public AggregateCfg, public UlogCfg
{
SessionCfg (const string name);
virtual ~SessionCfg ();
AtomicCfg *tcl_bridge;
bool verbose;
bool use_stdio;
+ void add_ulog_file (const string filename);
+ map<const string, AtomicCfg *> ulog_map;
};
class CpuCfg :
};
class BoardCfg :
- virtual public AggregateCfg
+virtual public AggregateCfg, public UlogCfg
{
public:
BoardCfg (const string name,
virtual void trace_disassemble ();
virtual void trace_core ();
virtual void write_config (Writer &w);
+
virtual ~BoardCfg ();
GlueSeqCfg *cache_flush_net;
// mainDynamic.cxx - high-tech mainline. -*- C++ -*-
-// Copyright (C) 1999, 2000, 2001, 2002 Red Hat.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Red Hat.
// This file is part of SID and is licensed under the GPL.
// See the file COPYING.SID for conditions for redistribution.
<< " mmap Memory map given file" << endl
<< " latency=r:w Set read, write latencies [0:0]" << endl
<< " latency=rw Set both latencies [0]" << endl;
+ cout << "--ulog-level=LEVEL Set the logging level for the current board" << endl;
+ cout << "--ulog-mode=less|match|equal" << endl
+ << " Set the logging mode for the current board" << endl;
+ cout << "--ulog-file=*|FILE Set the log file name" << endl;
cout << endl
<< " note: most board-specific options can be used in board-neutral position " << endl
<< " where they are interpreted as session-specific or default settings. " << endl;
i != bases.end(); ++i)
{
Mapping m = Mapping()
- .slave(mem).bus(port).base(0)
+ .slave(mem).bus(port)
.low(*i).high((*i) + size - 1);
if (map)
- map->map (m);
+ map->map (m.base(0));
else if (board)
board->add_memory (m);
else
trace_disassemble (false),
trace_counter (false),
trace_core (false),
+ ulog_level (0),
+ ulog_mode ("less"),
+ ulog_file ("-"),
step_insn_count ("10000")
{}
string cpu;
bool trace_disassemble;
bool trace_counter;
bool trace_core;
+ sid::host_int_4 ulog_level;
+ string ulog_mode;
+ string ulog_file;
string step_insn_count;
};
opt_insn_count, opt_load, opt_icache, opt_dcache,
opt_memory_region, opt_trace_extract, opt_trace_semantics,
opt_trace_disassemble, opt_trace_counter, opt_trace_core,
- opt_final_insn_count, opt_eb, opt_el, opt_gprof };
+ opt_final_insn_count, opt_eb, opt_el, opt_gprof,
+ opt_ulog_level, opt_ulog_mode, opt_ulog_file };
int curr_opt;
{"final-insn-count", no_argument, & curr_opt, opt_final_insn_count },
{"EB", no_argument, & curr_opt, opt_eb },
{"EL", no_argument, & curr_opt, opt_el },
+ {"ulog-level", required_argument, &curr_opt, opt_ulog_level },
+ {"ulog-mode", required_argument, &curr_opt, opt_ulog_mode },
+ {"ulog-file", required_argument, &curr_opt, opt_ulog_file },
{ 0, 0, NULL, 0 }
};
curr_board->trace_core();
if (defaults.enable_warnings)
curr_board->enable_warnings();
+ curr_board->set_ulog_level (defaults.ulog_level);
+ curr_board->set_ulog_mode (defaults.ulog_mode);
+ curr_board->set_ulog_file (defaults.ulog_file);
if (defaults.step_insn_count != "10000")
curr_board->set_step_insn_count(defaults.step_insn_count);
break;
}
}
break;
+
+ case opt_ulog_level:
+ if (curr_board)
+ curr_board->set_ulog_level (optaddr ("ulog-level"));
+ else
+ {
+ defaults.ulog_level = optaddr ("ulog-level");
+ need_sess (sess);
+ sess->set_ulog_level (optaddr ("ulog-level"));
+ }
+ break;
+
+ case opt_ulog_mode:
+ if (curr_board)
+ curr_board->set_ulog_mode (optstring ());
+ else
+ {
+ defaults.ulog_mode = optstring ();
+ need_sess (sess);
+ sess->set_ulog_mode (optstring ());
+ }
+ break;
+
+ case opt_ulog_file:
+ need_sess (sess);
+ sess->add_ulog_file (optstring ());
+ if (curr_board)
+ curr_board->set_ulog_file (optstring ());
+ else
+ {
+ defaults.ulog_file = optstring ();
+ sess->set_ulog_file (optstring ());
+ }
+ break;
}
break;