OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [mmix-mem.w] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 hellwig
% This file is part of the MMIXware package (c) Donald E Knuth 1999
2
@i boilerplate.w %<< legal stuff: PLEASE READ IT BEFORE MAKING ANY CHANGES!
3
 
4
\def\title{MMIX-MEM}
5
\def\MMIX{\.{MMIX}}
6
\def\Hex#1{\hbox{$^{\scriptscriptstyle\#}$\tt#1}} % experimental hex constant
7
@s octa int
8
 
9
@* Memory-mapped input and output. This module supplies procedures for reading
10
@^I/O@>
11
@^input/output@>
12
@^memory-mapped input/output@>
13
and writing \MMIX\ memory addresses that exceed 48 bits. Such addresses are
14
used by the operating system for input and output, so they require special
15
treatment. At present only dummy versions of these routines are implemented.
16
Users who need nontrivial versions of |spec_read| and/or |spec_write| should
17
prepare their own and link them with the rest of the simulator.
18
 
19
@p
20
#include 
21
#include "mmix-pipe.h" /* header file for all modules */
22
extern octa read_hex(); /* found in the main program module */
23
static char buf[20];
24
 
25
@ If the |interactive_read_bit| of the |verbose| control is set,
26
the user is supposed to supply values dynamically. Otherwise
27
zero is read.
28
 
29
@p
30
octa spec_read @,@,@[ARGS((octa))@];@+@t}\6{@>
31
octa spec_read(addr)
32
  octa addr;
33
{
34
  octa val;
35
  if (verbose&interactive_read_bit) {
36
    printf("** Read from loc %08x%08x: ",addr.h,addr.l);
37
    fgets(buf,20,stdin);
38
    val=read_hex(buf);
39
  } else val.l=val.h=0;
40
  if (verbose&show_spec_bit)
41
    printf("   (spec_read %08x%08x from %08x%08x at time %d)\n",
42
      val.h,val.l,addr.h,addr.l,ticks.l);
43
  return val;
44
}
45
 
46
@ The default |spec_write| just reports its arguments, without actually
47
writing anything.
48
 
49
@p
50
void spec_write @,@,@[ARGS((octa,octa))@];@+@t}\6{@>
51
void spec_write(addr,val)
52
  octa addr,val;
53
{
54
  if (verbose&show_spec_bit)
55
    printf("   (spec_write %08x%08x to %08x%08x at time %d)\n",
56
      val.h,val.l,addr.h,addr.l,ticks.l);
57
}
58
 
59
@* Index.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.