Fixed a bug regarding signal widths
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Sun, 13 Dec 2020 20:37:23 +0000 (21:37 +0100)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Thu, 14 Jan 2021 14:44:03 +0000 (15:44 +0100)
plugins/net.mograsim.logic.model.verilog/src/net/mograsim/logic/model/verilog/model/signals/Input.java
plugins/net.mograsim.logic.model.verilog/src/net/mograsim/logic/model/verilog/model/signals/Output.java
plugins/net.mograsim.logic.model.verilog/src/net/mograsim/logic/model/verilog/model/signals/Wire.java

index f80f808..0e8669a 100644 (file)
@@ -10,6 +10,6 @@ public class Input extends IOPort
        @Override
        public String toDeclarationVerilogCode()
        {
-               return "input [" + getWidth() + ":0] " + getName();
+               return "input [" + (getWidth() - 1) + ":0] " + getName();
        }
 }
index 0cea00b..4068d27 100644 (file)
@@ -10,6 +10,6 @@ public class Output extends IOPort
        @Override
        public String toDeclarationVerilogCode()
        {
-               return "output [" + getWidth() + ":0] " + getName();
+               return "output [" + (getWidth() - 1) + ":0] " + getName();
        }
 }
index 10e2a50..7e0f2cc 100644 (file)
@@ -9,6 +9,6 @@ public class Wire extends Signal
 
        public String toDeclarationVerilogCode()
        {
-               return "wire [" + getWidth() + ":0] " + getName() + ";";
+               return "wire [" + (getWidth() - 1) + ":0] " + getName() + ";";
        }
 }