diff --git a/simics-workspace/modules/afdxES2/Makefile b/simics-workspace/modules/afdxES2/Makefile
index 9aade7c..4a6d75b 100644
--- a/simics-workspace/modules/afdxES2/Makefile
+++ b/simics-workspace/modules/afdxES2/Makefile
@@ -5,7 +5,7 @@
 #

 MODULE_CLASSES = afdxES2
-SRC_FILES =
+SRC_FILES = record_mib.c
 DML_FILES = afdxES2.dml
 DMLC_FLAGS = -m -I$(SIMICS_WORKSPACE)/include

diff --git a/simics-workspace/modules/afdxES2/afdxES2.dml b/simics-workspace/modules/afdxES2/afdxES2.dml
index 0039425..426799c 100644
--- a/simics-workspace/modules/afdxES2/afdxES2.dml
+++ b/simics-workspace/modules/afdxES2/afdxES2.dml
@@ -26,92 +26,9 @@ import "packet-description.dml";
 import "quick-sort.dml";
 import "binary-search.dml";
 import "rm-handler.dml";
-header %{
-#include <stdio.h>
-	//extern void write_mid(MAC_MIB *maca_mib,MAC_MIB *macb_mib, RX_MIB *rx_mib, TX_MIB *tx_mib);
-    %}

 extern void write_mid(MAC_MIB *maca_mib,MAC_MIB *macb_mib, RX_MIB *rx_mib, TX_MIB *tx_mib);

-footer %{
-    void write_mid(MAC_MIB *maca_mib,MAC_MIB *macb_mib, RX_MIB *rx_mib, TX_MIB *tx_mib) {
-
-        FILE *mib_file = fopen("./mib_file", "w");    // look at here!
-        fprintf(mib_file, "========================================= Mac A mib begin ===================================================");
-        fprintf(mib_file, "crc_error: %d\n", maca_mib->crc_error);
-        fprintf(mib_file, "delete_little_64: %d\n", maca_mib->delete_little_64);
-        fprintf(mib_file, "delete_big_1518: %d\n", maca_mib->delete_big_1518);
-        fprintf(mib_file, "input_frame_count: %d\n", maca_mib->input_frame_count);
-        fprintf(mib_file, "input_64_127_count: %d\n", maca_mib->input_64_127_count);
-        fprintf(mib_file, "input_128_255_count: %d\n", maca_mib->input_128_255_count);
-        fprintf(mib_file, "input_256_511_count: %d\n", maca_mib->input_256_511_count);
-        fprintf(mib_file, "input_512_1023_count: %d\n", maca_mib->input_512_1023_count);
-        fprintf(mib_file, "input_1024_1518_count: %d\n", maca_mib->input_1024_1518_count);
-        fprintf(mib_file, "input_frame_byte_count: %d\n", maca_mib->input_frame_byte_count);
-        fprintf(mib_file, "output_frame_count: %d\n", maca_mib->output_frame_count);
-        fprintf(mib_file, "output_64_127_count: %d\n", maca_mib->output_64_127_count);
-        fprintf(mib_file, "output_128_255_count: %d\n", maca_mib->output_128_255_count);
-        fprintf(mib_file, "output_256_511_count: %d\n", maca_mib->output_256_511_count);
-        fprintf(mib_file, "output_512_1023_count: %d\n", maca_mib->output_512_1023_count);
-        fprintf(mib_file, "output_1024_1518_count: %d\n", maca_mib->output_1024_1518_count);
-        fprintf(mib_file, "output_frame_byte_count: %d\n", maca_mib->output_frame_byte_count);
-        fprintf(mib_file, "first_bit_error_count: %d\n", maca_mib->first_bit_error_count);
-        fprintf(mib_file, "ipchecksum_error_count: %d\n", maca_mib->ipchecksum_error_count);
-        fprintf(mib_file, "delete_bit_2048_count: %d\n", maca_mib->delete_bit_2048_count);
-
-        fprintf(mib_file, "========================================= Mac B mib begin ===================================================");
-        fprintf(mib_file, "crc_error: %d\n", macb_mib->crc_error);
-        fprintf(mib_file, "delete_little_64: %d\n", macb_mib->delete_little_64);
-        fprintf(mib_file, "delete_big_1518: %d\n", macb_mib->delete_big_1518);
-        fprintf(mib_file, "input_frame_count: %d\n", macb_mib->input_frame_count);
-        fprintf(mib_file, "input_64_127_count: %d\n", macb_mib->input_64_127_count);
-        fprintf(mib_file, "input_128_255_count: %d\n", macb_mib->input_128_255_count);
-        fprintf(mib_file, "input_256_511_count: %d\n", macb_mib->input_256_511_count);
-        fprintf(mib_file, "input_512_1023_count: %d\n", macb_mib->input_512_1023_count);
-        fprintf(mib_file, "input_1024_1518_count: %d\n", macb_mib->input_1024_1518_count);
-        fprintf(mib_file, "input_frame_byte_count: %d\n", macb_mib->input_frame_byte_count);
-        fprintf(mib_file, "output_frame_count: %d\n", macb_mib->output_frame_count);
-        fprintf(mib_file, "output_64_127_count: %d\n", macb_mib->output_64_127_count);
-        fprintf(mib_file, "output_128_255_count: %d\n", macb_mib->output_128_255_count);
-        fprintf(mib_file, "output_256_511_count: %d\n", macb_mib->output_256_511_count);
-        fprintf(mib_file, "output_512_1023_count: %d\n", macb_mib->output_512_1023_count);
-        fprintf(mib_file, "output_1024_1518_count: %d\n", macb_mib->output_1024_1518_count);
-        fprintf(mib_file, "output_frame_byte_count: %d\n", macb_mib->output_frame_byte_count);
-        fprintf(mib_file, "first_bit_error_count: %d\n", macb_mib->first_bit_error_count);
-        fprintf(mib_file, "ipchecksum_error_count: %d\n", macb_mib->ipchecksum_error_count);
-        fprintf(mib_file, "delete_bit_2048_count: %d\n", macb_mib->delete_bit_2048_count);
-
-
-        fprintf(mib_file, "========================================= rx mib begin =====================================================");
-        fprintf(mib_file, "disable_A_filt_count: %d\n", rx_mib->disable_A_filt_count);
-        fprintf(mib_file, "disable_B_filt_count: %d\n", rx_mib->disable_B_filt_count);
-        fprintf(mib_file, "A_integrated_filt_count: d\n", rx_mib->A_integrated_filt_count);
-        fprintf(mib_file, "B_integrated_filt_count: %d\n", rx_mib->B_integrated_filt_count);
-        fprintf(mib_file, "vl_id_filt_count: %d\n", rx_mib->vl_id_filt_count);
-        fprintf(mib_file, "redunt_filt_count: %d\n", rx_mib->redunt_filt_count);
-        fprintf(mib_file, "port_filt_count: %d\n", rx_mib->port_filt_count);
-        fprintf(mib_file, "ip_checksum_filt_count: %d\n", rx_mib->ip_checksum_filt_count);
-        fprintf(mib_file, "ip_length_error_filt_count: %d\n", rx_mib->ip_length_error_filt_count);
-        fprintf(mib_file, "udp_length_error_filt_count: %d\n", rx_mib->udp_length_error_filt_count);
-        fprintf(mib_file, "ip_fragment_error_filt_count: %d\n", rx_mib->ip_fragment_error_filt_count);
-        fprintf(mib_file, "overflow_count: %d\n", rx_mib->overflow_count);
-        fprintf(mib_file, "rx_icmp_reback_count: %d\n", rx_mib->rx_icmp_reback_count);
-        fprintf(mib_file, "rx_ip_data_count: %d\n", rx_mib->rx_ip_data_count);
-        fprintf(mib_file, "rx_udp_data_count: %d\n", rx_mib->rx_udp_data_count);
-        fprintf(mib_file, "rx_icmp_data_count: %d\n", rx_mib->rx_icmp_data_count);
-        fprintf(mib_file, "icmp_overflow_count: %d\n", rx_mib->icmp_overflow_count);
-        fprintf(mib_file, "rx_icmp_big_max_count: %d\n", rx_mib->rx_icmp_big_max_count);
-        fprintf(mib_file, "rx_buffer_clear_delete_count: %d\n", rx_mib->rx_buffer_clear_delete_count);
-
-        fprintf(mib_file, "========================================= tx mib begin =====================================================");
-        fprintf(mib_file, "tx_ip_count: %d\n", tx_mib->tx_ip_count);
-        fprintf(mib_file, "tx_udp_count: %d\n", tx_mib->tx_udp_count);
-        fprintf(mib_file, "tx_icmp_count: %d\n", tx_mib->tx_icmp_count);
-
-        fclose(mib_file);
-    }
-    %}
-
 attribute debug_cfg {
     parameter allocate_type = "bool";
 }
diff --git a/simics-workspace/modules/afdxES2/record_mib.c b/simics-workspace/modules/afdxES2/record_mib.c
index e69de29..e95522c 100644
--- a/simics-workspace/modules/afdxES2/record_mib.c
+++ b/simics-workspace/modules/afdxES2/record_mib.c
@@ -0,0 +1,77 @@
+#include "record_mib.h"
+
+void write_mid(MAC_MIB *maca_mib, MAC_MIB *macb_mib, RX_MIB *rx_mib, TX_MIB *tx_mib) {
+    FILE *mib_file = fopen("./mib_file.conf", "w");    // look at here!
+    fprintf(mib_file, "========================================= Mac A mib begin ===================================================");
+    fprintf(mib_file, "crc_error: %d\n", maca_mib->crc_error);
+    fprintf(mib_file, "delete_little_64: %d\n", maca_mib->delete_little_64);
+    fprintf(mib_file, "delete_big_1518: %d\n", maca_mib->delete_big_1518);
+    fprintf(mib_file, "input_frame_count: %d\n", maca_mib->input_frame_count);
+    fprintf(mib_file, "input_64_127_count: %d\n", maca_mib->input_64_127_count);
+    fprintf(mib_file, "input_128_255_count: %d\n", maca_mib->input_128_255_count);
+    fprintf(mib_file, "input_256_511_count: %d\n", maca_mib->input_256_511_count);
+    fprintf(mib_file, "input_512_1023_count: %d\n", maca_mib->input_512_1023_count);
+    fprintf(mib_file, "input_1024_1518_count: %d\n", maca_mib->input_1024_1518_count);
+    fprintf(mib_file, "input_frame_byte_count: %d\n", maca_mib->input_frame_byte_count);
+    fprintf(mib_file, "output_frame_count: %d\n", maca_mib->output_frame_count);
+    fprintf(mib_file, "output_64_127_count: %d\n", maca_mib->output_64_127_count);
+    fprintf(mib_file, "output_128_255_count: %d\n", maca_mib->output_128_255_count);
+    fprintf(mib_file, "output_256_511_count: %d\n", maca_mib->output_256_511_count);
+    fprintf(mib_file, "output_512_1023_count: %d\n", maca_mib->output_512_1023_count);
+    fprintf(mib_file, "output_1024_1518_count: %d\n", maca_mib->output_1024_1518_count);
+    fprintf(mib_file, "output_frame_byte_count: %d\n", maca_mib->output_frame_byte_count);
+    fprintf(mib_file, "first_bit_error_count: %d\n", maca_mib->first_bit_error_count);
+    fprintf(mib_file, "ipchecksum_error_count: %d\n", maca_mib->ipchecksum_error_count);
+    fprintf(mib_file, "delete_bit_2048_count: %d\n", maca_mib->delete_bit_2048_count);
+
+    fprintf(mib_file, "========================================= Mac B mib begin ===================================================");
+    fprintf(mib_file, "crc_error: %d\n", macb_mib->crc_error);
+    fprintf(mib_file, "delete_little_64: %d\n", macb_mib->delete_little_64);
+    fprintf(mib_file, "delete_big_1518: %d\n", macb_mib->delete_big_1518);
+    fprintf(mib_file, "input_frame_count: %d\n", macb_mib->input_frame_count);
+    fprintf(mib_file, "input_64_127_count: %d\n", macb_mib->input_64_127_count);
+    fprintf(mib_file, "input_128_255_count: %d\n", macb_mib->input_128_255_count);
+    fprintf(mib_file, "input_256_511_count: %d\n", macb_mib->input_256_511_count);
+    fprintf(mib_file, "input_512_1023_count: %d\n", macb_mib->input_512_1023_count);
+    fprintf(mib_file, "input_1024_1518_count: %d\n", macb_mib->input_1024_1518_count);
+    fprintf(mib_file, "input_frame_byte_count: %d\n", macb_mib->input_frame_byte_count);
+    fprintf(mib_file, "output_frame_count: %d\n", macb_mib->output_frame_count);
+    fprintf(mib_file, "output_64_127_count: %d\n", macb_mib->output_64_127_count);
+    fprintf(mib_file, "output_128_255_count: %d\n", macb_mib->output_128_255_count);
+    fprintf(mib_file, "output_256_511_count: %d\n", macb_mib->output_256_511_count);
+    fprintf(mib_file, "output_512_1023_count: %d\n", macb_mib->output_512_1023_count);
+    fprintf(mib_file, "output_1024_1518_count: %d\n", macb_mib->output_1024_1518_count);
+    fprintf(mib_file, "output_frame_byte_count: %d\n", macb_mib->output_frame_byte_count);
+    fprintf(mib_file, "first_bit_error_count: %d\n", macb_mib->first_bit_error_count);
+    fprintf(mib_file, "ipchecksum_error_count: %d\n", macb_mib->ipchecksum_error_count);
+    fprintf(mib_file, "delete_bit_2048_count: %d\n", macb_mib->delete_bit_2048_count);
+
+
+    fprintf(mib_file, "========================================= rx mib begin =====================================================");
+    fprintf(mib_file, "disable_A_filt_count: %d\n", rx_mib->disable_A_filt_count);
+    fprintf(mib_file, "disable_B_filt_count: %d\n", rx_mib->disable_B_filt_count);
+    fprintf(mib_file, "A_integrated_filt_count: d\n", rx_mib->A_integrated_filt_count);
+    fprintf(mib_file, "B_integrated_filt_count: %d\n", rx_mib->B_integrated_filt_count);
+    fprintf(mib_file, "vl_id_filt_count: %d\n", rx_mib->vl_id_filt_count);
+    fprintf(mib_file, "redunt_filt_count: %d\n", rx_mib->redunt_filt_count);
+    fprintf(mib_file, "port_filt_count: %d\n", rx_mib->port_filt_count);
+    fprintf(mib_file, "ip_checksum_filt_count: %d\n", rx_mib->ip_checksum_filt_count);
+    fprintf(mib_file, "ip_length_error_filt_count: %d\n", rx_mib->ip_length_error_filt_count);
+    fprintf(mib_file, "udp_length_error_filt_count: %d\n", rx_mib->udp_length_error_filt_count);
+    fprintf(mib_file, "ip_fragment_error_filt_count: %d\n", rx_mib->ip_fragment_error_filt_count);
+    fprintf(mib_file, "overflow_count: %d\n", rx_mib->overflow_count);
+    fprintf(mib_file, "rx_icmp_reback_count: %d\n", rx_mib->rx_icmp_reback_count);
+    fprintf(mib_file, "rx_ip_data_count: %d\n", rx_mib->rx_ip_data_count);
+    fprintf(mib_file, "rx_udp_data_count: %d\n", rx_mib->rx_udp_data_count);
+    fprintf(mib_file, "rx_icmp_data_count: %d\n", rx_mib->rx_icmp_data_count);
+    fprintf(mib_file, "icmp_overflow_count: %d\n", rx_mib->icmp_overflow_count);
+    fprintf(mib_file, "rx_icmp_big_max_count: %d\n", rx_mib->rx_icmp_big_max_count);
+    fprintf(mib_file, "rx_buffer_clear_delete_count: %d\n", rx_mib->rx_buffer_clear_delete_count);
+
+    fprintf(mib_file, "========================================= tx mib begin =====================================================");
+    fprintf(mib_file, "tx_ip_count: %d\n", tx_mib->tx_ip_count);
+    fprintf(mib_file, "tx_udp_count: %d\n", tx_mib->tx_udp_count);
+    fprintf(mib_file, "tx_icmp_count: %d\n", tx_mib->tx_icmp_count);
+
+    fclose(mib_file);
+}
diff --git a/simics-workspace/modules/afdxES2/record_mib.h b/simics-workspace/modules/afdxES2/record_mib.h
index e69de29..6574df2 100644
--- a/simics-workspace/modules/afdxES2/record_mib.h
+++ b/simics-workspace/modules/afdxES2/record_mib.h
@@ -0,0 +1,62 @@
+#ifndef RECORD_MIB_H
+#define RECORD_MIB_H
+
+#include <stdio.h>
+
+typedef unsigned int uint32;
+
+typedef struct _MAC_MIB {
+    uint32 crc_error;   				//crc checksum error
+    uint32 delete_little_64;  			//delete the frame that size is little than 64B
+    uint32 delete_big_1518;   			//delete the frame that size is bigger than 1518B
+    uint32 input_frame_count;  			// input frame count
+    uint32 input_64_127_count;			//input frame size between 64 and 127
+    uint32 input_128_255_count;			//input frame size between 128 and 255
+    uint32 input_256_511_count;			//input frame size between 256 and 511
+    uint32 input_512_1023_count;		//input frame size between 512 and 1023
+    uint32 input_1024_1518_count;		//input frame size between 1024 and 1023
+    uint32 input_frame_byte_count; 		// input frame byte count
+    uint32 output_frame_count;  		// output frame byte count
+    uint32 output_64_127_count;			//output frame size between 64 and 127
+    uint32 output_128_255_count;		//output frame size between 128 and 255
+    uint32 output_256_511_count;		//output frame size between 256 and 511
+    uint32 output_512_1023_count;		//output frame size between 512 and 1023
+    uint32 output_1024_1518_count;		//output frame size between 1024 and 1023
+    uint32 output_frame_byte_count;  	// output frame byte count
+    uint32 first_bit_error_count;		//first bit error
+    uint32 ipchecksum_error_count;		//ip checksum error
+    uint32 delete_bit_2048_count;		//delete the frame bigger than 2048
+} MAC_MIB;
+
+typedef struct _RX_MIB {
+    uint32 disable_A_filt_count;
+    uint32 disable_B_filt_count;
+    uint32 A_integrated_filt_count;
+    uint32 B_integrated_filt_count;
+    uint32 vl_id_filt_count;
+    uint32 redunt_filt_count;
+    uint32 port_filt_count;
+    uint32 ip_checksum_filt_count;
+    uint32 ip_length_error_filt_count;
+    uint32 udp_length_error_filt_count;
+    uint32 ip_fragment_error_filt_count ;
+    uint32 overflow_count;
+    uint32 rx_icmp_reback_count;
+    uint32 rx_ip_data_count;
+    uint32 rx_udp_data_count;
+    uint32 rx_icmp_data_count;
+    uint32 icmp_overflow_count;
+    uint32 rx_icmp_big_max_count;
+    uint32 rx_buffer_clear_delete_count;
+    uint32 size;
+} RX_MIB;
+
+typedef struct _TX_MIB {
+    uint32 tx_ip_count;
+    uint32 tx_udp_count;
+    uint32 tx_icmp_count;
+} TX_MIB;
+
+extern void write_mid(MAC_MIB *maca_mib, MAC_MIB *macb_mib, RX_MIB *rx_mib, TX_MIB *tx_mib);
+
+#endif