ecp5: Sim model fixes
authorDavid Shah <dave@ds0.me>
Thu, 18 Oct 2018 18:40:02 +0000 (19:40 +0100)
committerDavid Shah <dave@ds0.me>
Fri, 19 Oct 2018 14:16:40 +0000 (15:16 +0100)
Signed-off-by: David Shah <dave@ds0.me>
techlibs/ecp5/cells_sim.v

index e43632c640f4937f3f5266115a8b0fd0a77d0609..6e4b0a5ac771916cbc6d0d8d5600cabfe78c5f24 100644 (file)
@@ -265,16 +265,18 @@ module TRELLIS_IO(
        output O
 );
        parameter DIR = "INPUT";
+       reg T_pd;
+       always @(*) if (T === 1'bz) T_pd <= 1'b0; else T_pd <= T;
 
        generate
                if (DIR == "INPUT") begin
                        assign B = 1'bz;
                        assign O = B;
                end else if (DIR == "OUTPUT") begin
-                       assign B = T ? 1'bz : I;
+                       assign B = T_pd ? 1'bz : I;
                        assign O = 1'bx;
-               end else if (DIR == "INOUT") begin
-                       assign B = T ? 1'bz : I;
+               end else if (DIR == "BIDIR") begin
+                       assign B = T_pd ? 1'bz : I;
                        assign O = B;
                end else begin
                        ERROR_UNKNOWN_IO_MODE error();