From 87c5e1ecf241772e323f875b27766ac938f5d517 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A9lina?= <melina.wang@imt-atlantique.net>
Date: Wed, 21 May 2025 16:21:44 +0200
Subject: [PATCH] version finale

---
 Compte_rendu/.gitkeep              |   0
 Compte_rendu/wave_generator.drawio |  52 ----------
 Compte_rendu/wave_generator.vhd    | 161 -----------------------------
 src/hdl/wave_generator.vhd         |  60 +++++------
 4 files changed, 30 insertions(+), 243 deletions(-)
 delete mode 100644 Compte_rendu/.gitkeep
 delete mode 100644 Compte_rendu/wave_generator.drawio
 delete mode 100644 Compte_rendu/wave_generator.vhd

diff --git a/Compte_rendu/.gitkeep b/Compte_rendu/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/Compte_rendu/wave_generator.drawio b/Compte_rendu/wave_generator.drawio
deleted file mode 100644
index 6d65d82..0000000
--- a/Compte_rendu/wave_generator.drawio
+++ /dev/null
@@ -1,52 +0,0 @@
-<mxfile host="Electron" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/26.2.2 Chrome/134.0.6998.178 Electron/35.1.2 Safari/537.36" version="26.2.2">
-  <diagram name="Page-1" id="ZRCvXX_TBlFcA-i0oMmK">
-    <mxGraphModel dx="3237" dy="1203" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
-      <root>
-        <mxCell id="0" />
-        <mxCell id="1" parent="0" />
-        <mxCell id="liv1zIGuVtiVySRaDl_v-15" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;fontColor=#333333;strokeColor=#666666;arcSize=3;" parent="1" vertex="1">
-          <mxGeometry y="40" width="1320" height="720" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-1" value="A" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="160" y="80" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-2" value="D" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="160" y="320" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-3" value="B" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="520" y="80" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-4" value="I" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="880" y="560" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-5" value="F" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="880" y="320" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-6" value="C" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="880" y="80" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-7" value="G" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="160" y="560" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-8" value="H" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="520" y="560" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-9" value="E" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Ubuntu Mono;fontSize=40;" parent="1" vertex="1">
-          <mxGeometry x="520" y="320" width="280" height="160" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-10" value="I_clk" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#f0a30a;strokeColor=#BD7000;fontColor=#000000;fontFamily=Ubuntu Mono;fontSize=18;fontStyle=1" parent="1" vertex="1">
-          <mxGeometry x="-40" y="120" width="160" height="40" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-11" value="I_rst" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#f0a30a;strokeColor=#BD7000;fontColor=#000000;fontFamily=Ubuntu Mono;fontSize=18;fontStyle=1" parent="1" vertex="1">
-          <mxGeometry x="-40" y="200" width="160" height="40" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-12" value="I_wave_sel" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#f0a30a;strokeColor=#BD7000;fontColor=#000000;fontFamily=Ubuntu Mono;fontSize=18;fontStyle=1" parent="1" vertex="1">
-          <mxGeometry x="-40" y="280" width="160" height="40" as="geometry" />
-        </mxCell>
-        <mxCell id="liv1zIGuVtiVySRaDl_v-14" value="O_wav" style="shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;fillColor=#f0a30a;strokeColor=#BD7000;fontColor=#000000;fontFamily=Ubuntu Mono;fontSize=18;fontStyle=1" parent="1" vertex="1">
-          <mxGeometry x="1200" y="120" width="160" height="40" as="geometry" />
-        </mxCell>
-      </root>
-    </mxGraphModel>
-  </diagram>
-</mxfile>
diff --git a/Compte_rendu/wave_generator.vhd b/Compte_rendu/wave_generator.vhd
deleted file mode 100644
index b6d2b2b..0000000
--- a/Compte_rendu/wave_generator.vhd
+++ /dev/null
@@ -1,161 +0,0 @@
--- TOP module of a wave generator
--- generic parameters:
--- N: number of bits of the sine value
--- f0: fundamental frequency
--- fs: sampling frequency
--- Inputs:
--- CLK, RST
--- WAVE_SEL : selects the type of waveform (sine, square, triangle, saw-tooth)
--- Outputs:
--- WAV: the wave output
-
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-use ieee.math_real.all;
-
-entity wave_generator is
-    generic (
-        G_N  : integer := 8;
-        G_f0 : real    := 1.0;
-        G_fs : real    := 100.0
-        );
-    port (
-        I_clk      : in  std_logic;
-        I_rst      : in  std_logic;
-        I_wave_sel : in  std_logic_vector(1 downto 0);
-        O_wav      : out std_logic_vector(G_N-1 downto 0)
-        );
-end wave_generator;
-
-architecture arch of wave_generator is
-
-    constant C_addr_half_w : integer := integer(ceil(log2(real(natural(floor(G_fs/(4.0*G_f0)))))));
-
-    signal S_addr                 : std_logic_vector(integer(ceil(log2(real(natural(floor(G_fs/(2.0*G_f0))))))) - 1 downto 0);
-    signal S_sine_out_lut         : std_logic_vector(G_N-1 downto 0);
-    signal S_square               : std_logic_vector(G_N-1 downto 0);
-    signal S_triangle_out_lut     : std_logic_vector(G_N-1 downto 0);
-    signal S_saw_tooth_out_lut    : std_logic_vector(G_N-1 downto 0);
-    signal S_opposite_wave_sample : std_logic_vector(G_N-1 downto 0);
-    signal S_wave_value           : std_logic_vector(G_N-1 downto 0);
-    signal S_wave_sample          : std_logic_vector(G_N-1 downto 0);
-    signal S_last                 : std_logic;
-    signal S_middle               : std_logic;
-    signal S_u_d                  : std_logic;
-    signal S_sign_sel             : std_logic;
-
-begin
-    -- Module A
-    A_inst : entity work.module_A
-        port map (
-            I_clk      => I_clk,
-            I_rst      => I_rst,
-            I_wave_sel => I_wave_sel,
-            I_middle   => S_middle,
-            I_last     => S_last,
-            O_u_d      => S_u_d,
-            O_sign_sel => S_sign_sel
-            );
-
-    -- Module B
-    B_inst : entity work.module_B
-        generic map (
-            G_MAX_VAL => natural(floor(G_fs/(2.0*G_f0)))
-            )
-        port map (
-            I_clk    => I_clk,
-            I_rst    => I_rst,
-            I_u_d    => S_u_d,
-            O_val    => S_addr,
-            O_last   => S_last,
-            O_middle => S_middle 
-            );
-
-    -- Module C
-    C_inst : entity work.module_C
-        generic map (
-            G_N  => G_N,
-            G_f0 => G_f0,
-            G_fs => G_fs
-            )
-        port map (
-            I_clk  => I_clk,
-            I_rst  => I_rst,
-            I_addr => S_addr(C_addr_half_w-1 downto 0),
-            O_sine => S_sine_out_lut
-            );
-
-    -- Module D
-    D_inst : entity work.module_D
-        generic map (
-            G_N  => G_N,
-            G_f0 => G_f0,
-            G_fs => G_fs
-            )
-        port map (
-            I_clk      => I_clk,
-            I_rst      => I_rst,
-            I_addr     => S_addr(C_addr_half_w-1 downto 0),
-            O_triangle => S_triangle_out_lut
-            );
-
-    -- Module E
-    E_inst : entity work.module_E
-        generic map (
-            G_N  => G_N,
-            G_f0 => G_f0,
-            G_fs => G_fs
-            )
-        port map (
-            I_clk       => I_clk,
-            I_rst       => I_rst,
-            I_addr      => S_addr,
-            O_saw_tooth => S_saw_tooth_out_lut
-            );
-
-    S_square <= ((G_N-1) => '0', others => '1');
-
-    -- Module F
-    F_inst : entity work.module_F
-        port map (
-            I_sel  => I_wave_sel,
-            I_din0 => S_sine_out_lut,
-            I_din1 => S_square,
-            I_din2 => S_saw_tooth_out_lut,
-            I_din3 => S_triangle_out_lut,
-            O_dout => S_wave_sample
-            );
-
-    -- Module G
-    G_inst : entity work.module_G
-        generic map(
-            G_N => G_N
-            )
-        port map (
-            I_din  => S_wave_sample,
-            O_dout => S_opposite_wave_sample 
-            );
-
-    -- Module H
-    H_inst : entity work.module_H
-        port map (
-            I_sel  => S_sign_sel,
-            I_din0 => S_wave_sample,
-            I_din1 => S_opposite_wave_sample,
-            O_dout => S_wave_value
-            );
-
-    -- Module I
-    I_inst : entity work.module_I
-        generic map (
-            G_N => G_N
-            )
-        port map (
-            I_clk  => I_clk,
-            I_rst  => I_rst,
-            I_din  => S_wave_value,
-            O_dout => O_wav
-            );
-
-end arch;
diff --git a/src/hdl/wave_generator.vhd b/src/hdl/wave_generator.vhd
index 310c78f..b6d2b2b 100644
--- a/src/hdl/wave_generator.vhd
+++ b/src/hdl/wave_generator.vhd
@@ -64,12 +64,12 @@ begin
             G_MAX_VAL => natural(floor(G_fs/(2.0*G_f0)))
             )
         port map (
-            I_clk    => ,
-            I_rst    => ,
-            I_u_d    => ,
-            O_val    => ,
-            O_last   => ,
-            O_middle =>
+            I_clk    => I_clk,
+            I_rst    => I_rst,
+            I_u_d    => S_u_d,
+            O_val    => S_addr,
+            O_last   => S_last,
+            O_middle => S_middle 
             );
 
     -- Module C
@@ -94,10 +94,10 @@ begin
             G_fs => G_fs
             )
         port map (
-            I_clk      => ,
-            I_rst      => ,
-            I_addr     => ,
-            O_triangle =>
+            I_clk      => I_clk,
+            I_rst      => I_rst,
+            I_addr     => S_addr(C_addr_half_w-1 downto 0),
+            O_triangle => S_triangle_out_lut
             );
 
     -- Module E
@@ -108,10 +108,10 @@ begin
             G_fs => G_fs
             )
         port map (
-            I_clk       => ,
-            I_rst       => ,
-            I_addr      => ,
-            O_saw_tooth =>
+            I_clk       => I_clk,
+            I_rst       => I_rst,
+            I_addr      => S_addr,
+            O_saw_tooth => S_saw_tooth_out_lut
             );
 
     S_square <= ((G_N-1) => '0', others => '1');
@@ -119,12 +119,12 @@ begin
     -- Module F
     F_inst : entity work.module_F
         port map (
-            I_sel  => ,
-            I_din0 => ,
-            I_din1 => ,
-            I_din2 => ,
-            I_din3 => ,
-            O_dout =>
+            I_sel  => I_wave_sel,
+            I_din0 => S_sine_out_lut,
+            I_din1 => S_square,
+            I_din2 => S_saw_tooth_out_lut,
+            I_din3 => S_triangle_out_lut,
+            O_dout => S_wave_sample
             );
 
     -- Module G
@@ -133,17 +133,17 @@ begin
             G_N => G_N
             )
         port map (
-            I_din  => ,
-            O_dout =>
+            I_din  => S_wave_sample,
+            O_dout => S_opposite_wave_sample 
             );
 
     -- Module H
     H_inst : entity work.module_H
         port map (
-            I_sel  => ,
-            I_din0 => ,
-            I_din1 => ,
-            O_dout =>
+            I_sel  => S_sign_sel,
+            I_din0 => S_wave_sample,
+            I_din1 => S_opposite_wave_sample,
+            O_dout => S_wave_value
             );
 
     -- Module I
@@ -152,10 +152,10 @@ begin
             G_N => G_N
             )
         port map (
-            I_clk  => ,
-            I_rst  => ,
-            I_din  => ,
-            O_dout =>
+            I_clk  => I_clk,
+            I_rst  => I_rst,
+            I_din  => S_wave_value,
+            O_dout => O_wav
             );
 
 end arch;
-- 
GitLab