add test and convert jtag to get/put
[shakti-peripherals.git] / src / peripherals / jtagdtm / jtagdtm.bsv
index aea5b3701f2bcf0bfe62db57560ca67f6348630a..cf5ae696181fd44dd54c052ef434ad806a94daa0 100644 (file)
@@ -15,13 +15,14 @@ package jtagdtm;
 /*====== Package imports ======= */
        import Clocks::*;
        import ConcatReg::*;
+       import GetPut::*;
        import FIFO::*;
        import FIFOF::*;
        import SpecialFIFOs::*;
        import DReg::*;
 /*======= Project imports ===== */
        `include "jtagdefines.bsv"
-       import defined_types::*;
+       //import defined_types::*;
 /*============================== */
 
 interface Ifc_jtagdtm;
@@ -69,15 +70,18 @@ interface Ifc_jtagdtm;
        method Bit#(1) scan_shift_en;
        /*======== JTAG input pins ===== */
        (*always_enabled,always_ready*)
-       method Action tms_i(Bit#(1) tms);
+    interface Put#(Bit#(1)) tms;
        (*always_enabled,always_ready*)
-       method Action tdi_i(Bit#(1) tdi);
+    interface Put#(Bit#(1)) tdi;
        /*==== inputs from Sub-modules === */
        method Action debug_tdi_i(Bit#(1) debug_tdi);
        /*======= JTAG Output Pins ====== */
        (*always_enabled,always_ready*)
-       method Bit#(1) tdo;
+    interface Get#(Bit#(1)) tdo;
        method Bit#(1) tdo_oe;
+       (*always_enabled,always_ready*)
+    interface Get#(Bit#(1)) tck;
+
        /*======== TAP States ============= */
        method Bit#(1) shift_dr;
        method Bit#(1) pause_dr;
@@ -514,12 +518,19 @@ typedef enum {TestLogicReset = 4'h0,  RunTestIdle    = 4'h1,  SelectDRScan   = 4
                scan_out_5_sr<=scan_out_5;
        endmethod
        /*======== JTAG input pins ===== */
-       method Action tms_i(Bit#(1) tms);
-               wr_tms<=tms;
-       endmethod
-       method Action tdi_i(Bit#(1) tdi);
-               wr_tdi<=tdi;
-       endmethod
+
+    interface tms = interface Put
+        method Action put(Bit#(1) in);
+                 wr_tms<=in;
+        endmethod
+    endinterface;
+
+    interface tdi = interface Put
+        method Action put(Bit#(1) in);
+          wr_tdi<=in;
+        endmethod
+    endinterface;
+
        /*============================= */
        method Action debug_tdi_i(Bit#(1) debug_tdi);
                wr_debug_tdi<=debug_tdi;
@@ -552,7 +563,18 @@ typedef enum {TestLogicReset = 4'h0,  RunTestIdle    = 4'h1,  SelectDRScan   = 4
        method bscan_in   = bs_sr;
        method scan_shift_en = wr_scan_shift_en[1];
        /*======= JTAG Output Pins ====== */
-       method tdo = crossed_output_tdo;
+    interface tck = interface Get
+        method ActionValue#(Bit#(1)) get;
+          return 'b1; //#def_clk;
+        endmethod
+    endinterface;
+
+    interface tdo = interface Get
+        method ActionValue#(Bit#(1)) get;
+          return crossed_output_tdo;
+        endmethod
+    endinterface;
+
        method debug_tdo = wr_tdi;
        method Bit#(1) tdo_oe = ((tapstate == ShiftIR) || (tapstate == ShiftDR))?1:0;
        method Action response_from_dm(Bit#(34) responsedm) if(response_from_DM.notFull);