aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-05-23 22:59:54 +0000
committerMike Frysinger <vapier@gentoo.org>2011-05-23 22:59:54 +0000
commit0e31da218e04915bca80802b87fa418b49780378 (patch)
tree8d0c58950e466f50deea4db7710f4559d2a22c5b /sim
parentc50491a797e94e65b9692ed05ff7536ee3df5b30 (diff)
downloadgdb-0e31da218e04915bca80802b87fa418b49780378.zip
gdb-0e31da218e04915bca80802b87fa418b49780378.tar.gz
gdb-0e31da218e04915bca80802b87fa418b49780378.tar.bz2
sim: glue: implement or/xor funcs
The glue device has a bunch of "todos" for the misc bitwise devices. So implement two for fun -- the glue-or and glue-xor. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog8
-rw-r--r--sim/common/dv-glue.c33
2 files changed, 34 insertions, 7 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 7db35bc..bd6a7ee 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-23 Mike Frysinger <vapier@gentoo.org>
+
+ * dv-glue.c (hw_glue_finish): Set type to glue_or when name is
+ glue-or, and set type to glue_xor when name is glue-xor.
+ (hw_glue_port_event): Return immediately when type is glue_io
+ or unmatched. Handle glue_or and glue_xor types. Move HW_TRACE
+ and hw_port_event calls from glue_and to end of function.
+
2011-05-11 Mike Frysinger <vapier@gentoo.org>
* callback.c, dv-pal.c, dv-sockser.c, hw-base.c, hw-device.c,
diff --git a/sim/common/dv-glue.c b/sim/common/dv-glue.c
index 4085801..b99487d 100644
--- a/sim/common/dv-glue.c
+++ b/sim/common/dv-glue.c
@@ -274,6 +274,10 @@ hw_glue_finish (struct hw *me)
glue->type = glue_io;
else if (strcmp (name, "glue-and") == 0)
glue->type = glue_and;
+ else if (strcmp (name, "glue-or") == 0)
+ glue->type = glue_or;
+ else if (strcmp (name, "glue-xor") == 0)
+ glue->type = glue_xor;
else
hw_abort (me, "unimplemented glue type");
}
@@ -358,26 +362,41 @@ hw_glue_port_event (struct hw *me,
my_port,
(unsigned long) glue->address + port * sizeof (unsigned_word),
level));
- break;
+ return;
}
case glue_and:
{
glue->output[0] = glue->input[0];
for (i = 1; i < glue->nr_inputs; i++)
glue->output[0] &= glue->input[i];
-
- HW_TRACE ((me, "and - port %d, level %d arrived - output %d",
- my_port, level, glue->output[0]));
-
- hw_port_event (me, 0, glue->output[0]);
+ break;
+ }
+ case glue_or:
+ {
+ glue->output[0] = glue->input[0];
+ for (i = 1; i < glue->nr_inputs; i++)
+ glue->output[0] |= glue->input[i];
+ break;
+ }
+ case glue_xor:
+ {
+ glue->output[0] = glue->input[0];
+ for (i = 1; i < glue->nr_inputs; i++)
+ glue->output[0] ^= glue->input[i];
break;
}
default:
{
hw_abort (me, "operator not implemented");
- break;
+ return;
}
}
+
+ /* If we fell through, we want to generate a port event. */
+ HW_TRACE ((me, "port %d, level %d arrived - output %d",
+ my_port, level, glue->output[0]));
+
+ hw_port_event (me, 0, glue->output[0]);
}