CycloneVHMachine.cc Source File

Back to the index.

CycloneVHMachine.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * For experiments with uClinux/i960.
29  *
30  * A binary (vmlinux) can be found on this page:
31  * https://web.archive.org/web/20010417034914/http://www.cse.ogi.edu/~kma/uClinux.html
32  *
33  * NOTE!!! The binary at http://www.uclinux.org/pub/uClinux/ports/i960/ is corrupt;
34  * it seems to have been uploaded/encoded with the wrong character encoding.
35  * (At least it is broken as of 2016-04-18.)
36  *
37  *
38  * See the following link for details about the Cyclone VH board:
39  *
40  * http://www.nj7p.org/Manuals/PDFs/Intel/273194-003.PDF
41  * "EVAL80960VH Evaluation Platform Board Manual, December 1998"
42  *
43  * and for the CPU:
44  *
45  * http://www.nj7p.info/Manuals/PDFs/Intel/273173-001.PDF
46  * "i960 VH Processor Developer's Manual, October 1998"
47  */
48 
50 #include "ComponentFactory.h"
51 #include "GXemul.h"
52 
53 
55 {
56  // Defaults:
58  settings["cpu"] = "i960CA"; // TODO: uClinux is compiled for i960Jx
59  settings["ram"] = "0x00400000";
60 
61  if (!ComponentFactory::GetCreationArgOverrides(settings, args))
62  return NULL;
63 
64 
66  if (machine.IsNULL())
67  return NULL;
68 
69  machine->SetVariableValue("template", "\"cyclonevh\"");
70 
71 
72  refcount_ptr<Component> mainbus =
74  if (mainbus.IsNULL())
75  return NULL;
76 
77  machine->AddChild(mainbus);
78 
79  // TODO: CPU frequency is perhaps 100 MHz?
81  ComponentFactory::CreateComponent("i960_cpu(model=" + settings["cpu"] + ")");
82  if (cpu.IsNULL())
83  return NULL;
84 
85  mainbus->AddChild(cpu);
86 
87 
89  if (ram.IsNULL())
90  return NULL;
91 
92  // DRAM is at a3c0 0000 - a3ff ffff according to
93  // https://groups.google.com/forum/#!topic/intel.microprocessors.i960/tgpjDcW5Dxc
94  ram->SetVariableValue("memoryMappedBase", "0xa3c00000");
95  ram->SetVariableValue("memoryMappedSize", settings["ram"]);
96  mainbus->AddChild(ram);
97 
98  // There is supposed to be a LED at e0040000 too. TODO.
99 
100  return machine;
101 }
102 
103 
104 string CycloneVHMachine::GetAttribute(const string& attributeName)
105 {
106  if (attributeName == "template")
107  return "yes";
108 
109  if (attributeName == "machine")
110  return "yes";
111 
112  if (attributeName == "stable")
113  return "yes";
114 
115  if (attributeName == "description")
116  return "Cyclone/VH i960 evaluation board machine.";
117 
118  if (attributeName == "comments")
119  return "For experiments with uClinux/i960.";
120 
121  return "";
122 }
123 
static refcount_ptr< Component > CreateComponent(const string &componentNameAndOptionalArgs, GXemul *gxemul=NULL)
Creates a component given a short component name.
static string GetAttribute(const string &attributeName)
Gets a Component attribute value.
static refcount_ptr< Component > Create(const ComponentCreateArgs &args)
Creates a "cyclonevh" Component tree.
map< string, string > ComponentCreationSettings
Definition: Component.h:46
Definition: cpu.h:326
bool SetVariableValue(const string &name, const string &expression)
Sets a variable to a new value.
Definition: Component.cc:1030
void AddChild(refcount_ptr< Component > childComponent, size_t insertPosition=(size_t) -1)
Adds a reference to a child component.
Definition: Component.cc:595
static bool GetCreationArgOverrides(ComponentCreationSettings &settings, const ComponentCreateArgs &createArgs)
Get override arguments for component creation.
bool IsNULL() const
Checks whether or not an object is referenced by the reference counted pointer.
Definition: refcount_ptr.h:216

Generated on Fri Dec 7 2018 19:52:23 for GXemul by doxygen 1.8.13