From 46d3ae7cbf11c266be34899afeb9ccdabff95bb0 Mon Sep 17 00:00:00 2001
From: Jack Driscoll <jd12g21@soton.ac.uk>
Date: Wed, 30 Oct 2024 14:58:41 +0000
Subject: [PATCH] prints a sampled output into csv file

---
 MSF/MSF_decoder/tb/basic_msf_signal_tb.vhd | 29 ++++++++++++++++------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/MSF/MSF_decoder/tb/basic_msf_signal_tb.vhd b/MSF/MSF_decoder/tb/basic_msf_signal_tb.vhd
index f8e7bb0..f0c0dd8 100644
--- a/MSF/MSF_decoder/tb/basic_msf_signal_tb.vhd
+++ b/MSF/MSF_decoder/tb/basic_msf_signal_tb.vhd
@@ -1,12 +1,8 @@
 library ieee;
 use ieee.std_logic_1164.all;
 use ieee.numeric_std.all;
---use ieee.numeric_std_unsigned;
 use std.textio.all;
 
---library STD;
---use STD.textio.all;
-
 
 entity basic_msf_signal_tb is
 end entity basic_msf_signal_tb;
@@ -81,9 +77,9 @@ architecture basic_msf_signal of basic_msf_signal_tb is
 		FAST_CLOCK_CYCLE: process
 			begin
 				fast_clk <= '0';
-				wait for 200 us;
+				wait for 1000 us;
 				fast_clk <= '1';
-				wait for 200 us;
+				wait for 1000 us;
 		end process FAST_CLOCK_CYCLE;
 		
 		--Read time data from file--
@@ -220,7 +216,26 @@ architecture basic_msf_signal of basic_msf_signal_tb is
 				end loop;
 		end process SEND_DATA;
 		
-		
+		--Sample output to text file--
+		SAMPLE_OUTPUT: process
+			variable filen_line	: line;
+			variable int_conv	: integer;
+			file f_SAMPLE_DATA	: text open write_mode is "H:\MSF_Project\msf_sample.csv";
+			begin
+				for i in 0 to 2000 loop
+					if h_filter_in = '1' then
+						int_conv := 1;
+					else
+						int_conv := 0;
+					end if;
+					wait until rising_edge(fast_clk);
+					write(filen_line, int_conv);
+					writeline(f_SAMPLE_DATA, filen_line);
+				end loop;
+	
+		end process SAMPLE_OUTPUT;
+
+
 	--end;
 	
 	
-- 
GitLab