aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-05-08 10:22:01 +0200
committerClifford Wolf <clifford@clifford.at>2016-05-08 10:22:01 +0200
commitfa76d51941ce5e4076317195bd1b603bccb74f02 (patch)
tree62dbb192cc8bbda1a10dc9148059ed0e4414e622
parentf103bfb9baddcd5ff16e610bc314c3de9eb3d526 (diff)
parent47eace0b9f2b9ddd7ae76e06e2ade85ceea88e17 (diff)
downloadyosys-fa76d51941ce5e4076317195bd1b603bccb74f02.tar.gz
yosys-fa76d51941ce5e4076317195bd1b603bccb74f02.tar.bz2
yosys-fa76d51941ce5e4076317195bd1b603bccb74f02.zip
Merge pull request #162 from azonenberg/master
Added GP_DELAY cell. Fixed several errors in simulation models.
-rw-r--r--techlibs/greenpak4/cells_sim.v35
1 files changed, 33 insertions, 2 deletions
diff --git a/techlibs/greenpak4/cells_sim.v b/techlibs/greenpak4/cells_sim.v
index 6cf29fe6e..be8e66c66 100644
--- a/techlibs/greenpak4/cells_sim.v
+++ b/techlibs/greenpak4/cells_sim.v
@@ -1,3 +1,5 @@
+`timescale 1ns/1ps
+
module GP_2LUT(input IN0, IN1, output OUT);
parameter [3:0] INIT = 0;
assign OUT = INIT[{IN1, IN0}];
@@ -67,7 +69,7 @@ module GP_COUNT8(input CLK, input wire RST, output reg OUT);
count <= count - 1'd1;
if(count == 0)
- count <= COUNT_MAX;
+ count <= COUNT_TO;
/*
if((RESET_MODE == "RISING") && RST)
@@ -92,6 +94,35 @@ module GP_COUNT14(input CLK, input wire RST, output reg OUT);
endmodule
+module GP_DELAY(input IN, output reg OUT);
+
+ parameter DELAY_STEPS = 1;
+
+ //TODO: additional delay/glitch filter mode
+
+ initial OUT = 0;
+
+ generate
+
+ //TODO: These delays are PTV dependent! For now, hard code 3v3 timing
+ //Change simulation-mode delay depending on global Vdd range (how to specify this?)
+ always @(*) begin
+ case(DELAY_STEPS)
+ 1: #166 OUT = IN;
+ 2: #318 OUT = IN;
+ 2: #471 OUT = IN;
+ 3: #622 OUT = IN;
+ default: begin
+ $display("ERROR: GP_DELAY must have DELAY_STEPS in range [1,4]");
+ $finish;
+ end
+ endcase
+ end
+
+ endgenerate
+
+endmodule
+
module GP_DFF(input D, CLK, output reg Q);
parameter [0:0] INIT = 1'bx;
initial Q = INIT;
@@ -284,7 +315,7 @@ module GP_SHREG(input nRST, input CLK, input IN, output OUTA, output OUTB);
reg[15:0] shreg = 0;
- always @(posedge clk, negedge nRST) begin
+ always @(posedge CLK, negedge nRST) begin
if(!nRST)
shreg = 0;