SlideShare a Scribd company logo
1 of 2
--------------------------------------------------------------------------------
-- UART
-- Simple loopback
--
-- @author         Peter A Bennett
-- @copyright      (c) 2012 Peter A Bennett
-- @license        LGPL
-- @email          pab850@googlemail.com
-- @contact        www.bytebash.com
--
--------------------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity LOOPBACK is
    port
    (
         -- General
         CLOCK                  :   in      std_logic;
         RESET                  :   in      std_logic;
         RX                     :   in      std_logic;
         TX                     :   out     std_logic
    );
end LOOPBACK;

architecture RTL of LOOPBACK is
    ----------------------------------------------------------------------------
    -- UART constants
    ----------------------------------------------------------------------------

    constant BAUD_RATE              : positive := 115200;
    constant CLOCK_FREQUENCY        : positive := 100000000;

    ----------------------------------------------------------------------------
    -- Component declarations
    ----------------------------------------------------------------------------
    component UART is
        generic (
                BAUD_RATE           : positive;
                CLOCK_FREQUENCY     : positive
            );
        port ( -- General
                CLOCK               :   in      std_logic;
                RESET               :   in      std_logic;
                DATA_STREAM_IN      :   in      std_logic_vector(7 downto 0);
                DATA_STREAM_IN_STB :    in      std_logic;
                DATA_STREAM_IN_ACK :    out     std_logic;
                DATA_STREAM_OUT     :   out     std_logic_vector(7 downto 0);
                DATA_STREAM_OUT_STB :   out     std_logic;
                DATA_STREAM_OUT_ACK :   in      std_logic;
                TX                  :   out     std_logic;
                RX                  :   in      std_logic
             );
    end component UART;

    ----------------------------------------------------------------------------
    -- UART signals
    ----------------------------------------------------------------------------

    signal uart_data_in             : std_logic_vector(7 downto 0);
    signal uart_data_out            : std_logic_vector(7 downto 0);
    signal uart_data_in_stb         : std_logic;
signal uart_data_in_ack              : std_logic;
    signal uart_data_out_stb             : std_logic;
    signal uart_data_out_ack             : std_logic;

begin

    ----------------------------------------------------------------------------
    -- UART instantiation
    ----------------------------------------------------------------------------

    UART_inst1 : UART
    generic map (
             BAUD_RATE             => BAUD_RATE,
             CLOCK_FREQUENCY       => CLOCK_FREQUENCY
    )
    port map     (
             -- General
             CLOCK                 =>   CLOCK,
             RESET                 =>   RESET,
             DATA_STREAM_IN        =>   uart_data_in,
             DATA_STREAM_IN_STB    =>   uart_data_in_stb,
             DATA_STREAM_IN_ACK    =>   uart_data_in_ack,
             DATA_STREAM_OUT       =>   uart_data_out,
             DATA_STREAM_OUT_STB   =>   uart_data_out_stb,
             DATA_STREAM_OUT_ACK   =>   uart_data_out_ack,
             TX                    =>   TX,
             RX                    =>   RX
    );

    ----------------------------------------------------------------------------
    -- Simple loopback, retransmit any received data
    ----------------------------------------------------------------------------

    UART_LOOPBACK : process (CLOCK)
    begin
        if rising_edge(CLOCK) then
            if RESET = '1' then
                 uart_data_in_stb        <= '0';
                 uart_data_out_ack       <= '0';
                 uart_data_in            <= (others => '0');
            else
                 -- Acknowledge data receive strobes and set up a transmission
                 -- request
                 uart_data_out_ack       <= '0';
                 if uart_data_out_stb = '1' then
                     uart_data_out_ack   <= '1';
                     uart_data_in_stb    <= '1';
                     uart_data_in        <= uart_data_out;
                 end if;

                 -- Clear transmission request strobe upon acknowledge.
                 if uart_data_in_ack = '1' then
                     uart_data_in_stb    <= '0';
                 end if;
            end if;
        end if;
    end process;

end RTL;

More Related Content

What's hot

Watching And Manipulating Your Network Traffic
Watching And Manipulating Your Network TrafficWatching And Manipulating Your Network Traffic
Watching And Manipulating Your Network TrafficJosiah Ritchie
 
Ahn pacsec2017 key-recovery_attacks_against_commercial_white-box_cryptography...
Ahn pacsec2017 key-recovery_attacks_against_commercial_white-box_cryptography...Ahn pacsec2017 key-recovery_attacks_against_commercial_white-box_cryptography...
Ahn pacsec2017 key-recovery_attacks_against_commercial_white-box_cryptography...PacSecJP
 
Oracle statistics by example
Oracle statistics by exampleOracle statistics by example
Oracle statistics by exampleMauro Pagano
 
Oracle12c For Developers
Oracle12c For DevelopersOracle12c For Developers
Oracle12c For DevelopersAlex Nuijten
 
Home automation system
Home automation system Home automation system
Home automation system Hira Shaukat
 
A close encounter_with_real_world_and_odd_perf_issues
A close encounter_with_real_world_and_odd_perf_issuesA close encounter_with_real_world_and_odd_perf_issues
A close encounter_with_real_world_and_odd_perf_issuesRiyaj Shamsudeen
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScriptJens Siebert
 
⭐⭐⭐⭐⭐ #PROTEUS #PCB DESIGN (2020 PAO2)
⭐⭐⭐⭐⭐ #PROTEUS #PCB DESIGN (2020 PAO2)⭐⭐⭐⭐⭐ #PROTEUS #PCB DESIGN (2020 PAO2)
⭐⭐⭐⭐⭐ #PROTEUS #PCB DESIGN (2020 PAO2)Victor Asanza
 
Functional Test Systems - Testing Days Bajío
Functional Test Systems - Testing Days BajíoFunctional Test Systems - Testing Days Bajío
Functional Test Systems - Testing Days BajíoInterlatin
 
OSMC 2015: Linux Performance Profiling and Monitoring by Werner Fischer
OSMC 2015: Linux Performance Profiling and Monitoring by Werner FischerOSMC 2015: Linux Performance Profiling and Monitoring by Werner Fischer
OSMC 2015: Linux Performance Profiling and Monitoring by Werner FischerNETWAYS
 
8-Bit CMOS Microcontrollers with nanoWatt Technology
8-Bit CMOS Microcontrollers with nanoWatt Technology8-Bit CMOS Microcontrollers with nanoWatt Technology
8-Bit CMOS Microcontrollers with nanoWatt TechnologyPremier Farnell
 

What's hot (17)

Watching And Manipulating Your Network Traffic
Watching And Manipulating Your Network TrafficWatching And Manipulating Your Network Traffic
Watching And Manipulating Your Network Traffic
 
Sql2
Sql2Sql2
Sql2
 
Ahn pacsec2017 key-recovery_attacks_against_commercial_white-box_cryptography...
Ahn pacsec2017 key-recovery_attacks_against_commercial_white-box_cryptography...Ahn pacsec2017 key-recovery_attacks_against_commercial_white-box_cryptography...
Ahn pacsec2017 key-recovery_attacks_against_commercial_white-box_cryptography...
 
Oracle statistics by example
Oracle statistics by exampleOracle statistics by example
Oracle statistics by example
 
Oracle12c For Developers
Oracle12c For DevelopersOracle12c For Developers
Oracle12c For Developers
 
Home automation system
Home automation system Home automation system
Home automation system
 
A close encounter_with_real_world_and_odd_perf_issues
A close encounter_with_real_world_and_odd_perf_issuesA close encounter_with_real_world_and_odd_perf_issues
A close encounter_with_real_world_and_odd_perf_issues
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScript
 
Iuwne10 S06 L03
Iuwne10 S06 L03Iuwne10 S06 L03
Iuwne10 S06 L03
 
Iuwne10 S06 L01
Iuwne10 S06 L01Iuwne10 S06 L01
Iuwne10 S06 L01
 
Readme
ReadmeReadme
Readme
 
⭐⭐⭐⭐⭐ #PROTEUS #PCB DESIGN (2020 PAO2)
⭐⭐⭐⭐⭐ #PROTEUS #PCB DESIGN (2020 PAO2)⭐⭐⭐⭐⭐ #PROTEUS #PCB DESIGN (2020 PAO2)
⭐⭐⭐⭐⭐ #PROTEUS #PCB DESIGN (2020 PAO2)
 
実践 memcached
実践 memcached実践 memcached
実践 memcached
 
Functional Test Systems - Testing Days Bajío
Functional Test Systems - Testing Days BajíoFunctional Test Systems - Testing Days Bajío
Functional Test Systems - Testing Days Bajío
 
OSMC 2015: Linux Performance Profiling and Monitoring by Werner Fischer
OSMC 2015: Linux Performance Profiling and Monitoring by Werner FischerOSMC 2015: Linux Performance Profiling and Monitoring by Werner Fischer
OSMC 2015: Linux Performance Profiling and Monitoring by Werner Fischer
 
Mysql56 replication
Mysql56 replicationMysql56 replication
Mysql56 replication
 
8-Bit CMOS Microcontrollers with nanoWatt Technology
8-Bit CMOS Microcontrollers with nanoWatt Technology8-Bit CMOS Microcontrollers with nanoWatt Technology
8-Bit CMOS Microcontrollers with nanoWatt Technology
 

Similar to Loopback.vhd

zen and the art of SQL optimization
zen and the art of SQL optimizationzen and the art of SQL optimization
zen and the art of SQL optimizationKaren Morton
 
IEEE 1149.1-2013 Addresses Challenges in Test Re-Use from IP to IC to Systems
IEEE 1149.1-2013 Addresses Challenges in Test Re-Use from IP to IC to SystemsIEEE 1149.1-2013 Addresses Challenges in Test Re-Use from IP to IC to Systems
IEEE 1149.1-2013 Addresses Challenges in Test Re-Use from IP to IC to SystemsIEEE Computer Society Computing Now
 
Laboratory Report Sample
Laboratory Report SampleLaboratory Report Sample
Laboratory Report SampleMarkus Flicke
 
Metadata Matters
Metadata MattersMetadata Matters
Metadata Mattersafa reg
 
Dsd lab Practical File
Dsd lab Practical FileDsd lab Practical File
Dsd lab Practical FileSoumya Behera
 
The_ERICSSON_commands_listed_below_are_f (1) (1).pdf
The_ERICSSON_commands_listed_below_are_f (1) (1).pdfThe_ERICSSON_commands_listed_below_are_f (1) (1).pdf
The_ERICSSON_commands_listed_below_are_f (1) (1).pdfssuser340a0c
 
2 g ms4099e dan ms4099f_alarm
2 g ms4099e dan ms4099f_alarm2 g ms4099e dan ms4099f_alarm
2 g ms4099e dan ms4099f_alarmheri Banget
 
2 g ms4099e dan ms4099f_alarm
2 g ms4099e dan ms4099f_alarm2 g ms4099e dan ms4099f_alarm
2 g ms4099e dan ms4099f_alarmheri Banget
 
Understanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersUnderstanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersEnkitec
 
Exadata - Smart Scan Testing
Exadata - Smart Scan TestingExadata - Smart Scan Testing
Exadata - Smart Scan TestingMonowar Mukul
 
Docfoc.com ericsson commands
Docfoc.com ericsson commandsDocfoc.com ericsson commands
Docfoc.com ericsson commandsadel kaoubi
 
Cardinality and the Optimizer
Cardinality and the OptimizerCardinality and the Optimizer
Cardinality and the OptimizerConnor McDonald
 
Virtual Clocks.ppt
Virtual Clocks.pptVirtual Clocks.ppt
Virtual Clocks.pptssuser3b4a81
 
fdocuments.in_the-ericsson-commands.pdf
fdocuments.in_the-ericsson-commands.pdffdocuments.in_the-ericsson-commands.pdf
fdocuments.in_the-ericsson-commands.pdfSaidHaman
 
W8_2: Inside the UoS Educational Processor
W8_2: Inside the UoS Educational ProcessorW8_2: Inside the UoS Educational Processor
W8_2: Inside the UoS Educational ProcessorDaniel Roggen
 

Similar to Loopback.vhd (20)

zen and the art of SQL optimization
zen and the art of SQL optimizationzen and the art of SQL optimization
zen and the art of SQL optimization
 
IEEE 1149.1-2013 Addresses Challenges in Test Re-Use from IP to IC to Systems
IEEE 1149.1-2013 Addresses Challenges in Test Re-Use from IP to IC to SystemsIEEE 1149.1-2013 Addresses Challenges in Test Re-Use from IP to IC to Systems
IEEE 1149.1-2013 Addresses Challenges in Test Re-Use from IP to IC to Systems
 
Uart
UartUart
Uart
 
Q 1
Q 1Q 1
Q 1
 
Laboratory Report Sample
Laboratory Report SampleLaboratory Report Sample
Laboratory Report Sample
 
Metadata Matters
Metadata MattersMetadata Matters
Metadata Matters
 
Dsd lab Practical File
Dsd lab Practical FileDsd lab Practical File
Dsd lab Practical File
 
The_ERICSSON_commands_listed_below_are_f (1) (1).pdf
The_ERICSSON_commands_listed_below_are_f (1) (1).pdfThe_ERICSSON_commands_listed_below_are_f (1) (1).pdf
The_ERICSSON_commands_listed_below_are_f (1) (1).pdf
 
2 g ms4099e dan ms4099f_alarm
2 g ms4099e dan ms4099f_alarm2 g ms4099e dan ms4099f_alarm
2 g ms4099e dan ms4099f_alarm
 
2 g ms4099e dan ms4099f_alarm
2 g ms4099e dan ms4099f_alarm2 g ms4099e dan ms4099f_alarm
2 g ms4099e dan ms4099f_alarm
 
Understanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersUnderstanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-Developers
 
Exadata - Smart Scan Testing
Exadata - Smart Scan TestingExadata - Smart Scan Testing
Exadata - Smart Scan Testing
 
Uart
UartUart
Uart
 
Docfoc.com ericsson commands
Docfoc.com ericsson commandsDocfoc.com ericsson commands
Docfoc.com ericsson commands
 
Cardinality and the Optimizer
Cardinality and the OptimizerCardinality and the Optimizer
Cardinality and the Optimizer
 
8259
8259 8259
8259
 
Sr981 982+ultisolar new energy co ltd solar pump station solar water heater c...
Sr981 982+ultisolar new energy co ltd solar pump station solar water heater c...Sr981 982+ultisolar new energy co ltd solar pump station solar water heater c...
Sr981 982+ultisolar new energy co ltd solar pump station solar water heater c...
 
Virtual Clocks.ppt
Virtual Clocks.pptVirtual Clocks.ppt
Virtual Clocks.ppt
 
fdocuments.in_the-ericsson-commands.pdf
fdocuments.in_the-ericsson-commands.pdffdocuments.in_the-ericsson-commands.pdf
fdocuments.in_the-ericsson-commands.pdf
 
W8_2: Inside the UoS Educational Processor
W8_2: Inside the UoS Educational ProcessorW8_2: Inside the UoS Educational Processor
W8_2: Inside the UoS Educational Processor
 

Recently uploaded

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Loopback.vhd

  • 1. -------------------------------------------------------------------------------- -- UART -- Simple loopback -- -- @author Peter A Bennett -- @copyright (c) 2012 Peter A Bennett -- @license LGPL -- @email pab850@googlemail.com -- @contact www.bytebash.com -- -------------------------------------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity LOOPBACK is port ( -- General CLOCK : in std_logic; RESET : in std_logic; RX : in std_logic; TX : out std_logic ); end LOOPBACK; architecture RTL of LOOPBACK is ---------------------------------------------------------------------------- -- UART constants ---------------------------------------------------------------------------- constant BAUD_RATE : positive := 115200; constant CLOCK_FREQUENCY : positive := 100000000; ---------------------------------------------------------------------------- -- Component declarations ---------------------------------------------------------------------------- component UART is generic ( BAUD_RATE : positive; CLOCK_FREQUENCY : positive ); port ( -- General CLOCK : in std_logic; RESET : in std_logic; DATA_STREAM_IN : in std_logic_vector(7 downto 0); DATA_STREAM_IN_STB : in std_logic; DATA_STREAM_IN_ACK : out std_logic; DATA_STREAM_OUT : out std_logic_vector(7 downto 0); DATA_STREAM_OUT_STB : out std_logic; DATA_STREAM_OUT_ACK : in std_logic; TX : out std_logic; RX : in std_logic ); end component UART; ---------------------------------------------------------------------------- -- UART signals ---------------------------------------------------------------------------- signal uart_data_in : std_logic_vector(7 downto 0); signal uart_data_out : std_logic_vector(7 downto 0); signal uart_data_in_stb : std_logic;
  • 2. signal uart_data_in_ack : std_logic; signal uart_data_out_stb : std_logic; signal uart_data_out_ack : std_logic; begin ---------------------------------------------------------------------------- -- UART instantiation ---------------------------------------------------------------------------- UART_inst1 : UART generic map ( BAUD_RATE => BAUD_RATE, CLOCK_FREQUENCY => CLOCK_FREQUENCY ) port map ( -- General CLOCK => CLOCK, RESET => RESET, DATA_STREAM_IN => uart_data_in, DATA_STREAM_IN_STB => uart_data_in_stb, DATA_STREAM_IN_ACK => uart_data_in_ack, DATA_STREAM_OUT => uart_data_out, DATA_STREAM_OUT_STB => uart_data_out_stb, DATA_STREAM_OUT_ACK => uart_data_out_ack, TX => TX, RX => RX ); ---------------------------------------------------------------------------- -- Simple loopback, retransmit any received data ---------------------------------------------------------------------------- UART_LOOPBACK : process (CLOCK) begin if rising_edge(CLOCK) then if RESET = '1' then uart_data_in_stb <= '0'; uart_data_out_ack <= '0'; uart_data_in <= (others => '0'); else -- Acknowledge data receive strobes and set up a transmission -- request uart_data_out_ack <= '0'; if uart_data_out_stb = '1' then uart_data_out_ack <= '1'; uart_data_in_stb <= '1'; uart_data_in <= uart_data_out; end if; -- Clear transmission request strobe upon acknowledge. if uart_data_in_ack = '1' then uart_data_in_stb <= '0'; end if; end if; end if; end process; end RTL;