projects
/
Mograsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Interface pins are now sorted
[Mograsim.git]
/
plugins
/
net.mograsim.logic.model.verilog
/
src
/
net
/
mograsim
/
logic
/
model
/
verilog
/
model
/
signals
/
Signal.java
diff --git
a/plugins/net.mograsim.logic.model.verilog/src/net/mograsim/logic/model/verilog/model/signals/Signal.java
b/plugins/net.mograsim.logic.model.verilog/src/net/mograsim/logic/model/verilog/model/signals/Signal.java
index
e825ced
..
7ccf9cd
100644
(file)
--- a/
plugins/net.mograsim.logic.model.verilog/src/net/mograsim/logic/model/verilog/model/signals/Signal.java
+++ b/
plugins/net.mograsim.logic.model.verilog/src/net/mograsim/logic/model/verilog/model/signals/Signal.java
@@
-5,11
+5,13
@@
import java.util.Objects;
public abstract class Signal
{
private final Type type;
public abstract class Signal
{
private final Type type;
+ private final String name;
private final int width;
private final int width;
- public Signal(Type type, int width)
+ public Signal(Type type,
String name,
int width)
{
this.type = Objects.requireNonNull(type);
{
this.type = Objects.requireNonNull(type);
+ this.name = Objects.requireNonNull(name);
this.width = width;
check();
this.width = width;
check();
@@
-26,18
+28,33
@@
public abstract class Signal
return type;
}
return type;
}
+ public String getName()
+ {
+ return name;
+ }
+
public int getWidth()
{
return width;
}
public int getWidth()
{
return width;
}
- public abstract String toReferenceVerilogCode();
+ public String toReferenceVerilogCode()
+ {
+ return name;
+ }
+
+ @Override
+ public String toString()
+ {
+ return name + "[" + getWidth() + "]";
+ }
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + width;
return result;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + width;
return result;
@@
-53,6
+70,12
@@
public abstract class Signal
if (getClass() != obj.getClass())
return false;
Signal other = (Signal) obj;
if (getClass() != obj.getClass())
return false;
Signal other = (Signal) obj;
+ if (name == null)
+ {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
if (type != other.type)
return false;
if (width != other.width)
if (type != other.type)
return false;
if (width != other.width)
@@
-62,6
+85,6
@@
public abstract class Signal
public static enum Type
{
public static enum Type
{
- WIRE, IO_INPUT, IO_OUTPUT
, CONSTANT
;
+ WIRE, IO_INPUT, IO_OUTPUT;
}
}
}
}