在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1889|回复: 1

[讨论] UART : 减少资源的使用

[复制链接]
发表于 2017-12-10 20:19:27 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
谁有办法比原来的编码方法更进一步减少资源的使用吗?

http://hamsterworks.co.nz/mediawiki/index.php/TinyTx


use IEEE.STD_LOGIC_1164.ALL;

entity tiny_rs232_tx is
    Port ( clk         : in  STD_LOGIC;
       bit_tick    : in  STD_LOGIC;
       data        : in  STD_LOGIC_VECTOR(7 downto 0);
       data_enable : in  STD_LOGIC;
       tx          : out STD_LOGIC := '1';
       busy        : out STD_LOGIC );
end tiny_rs232_tx;

architecture Behavioral of tiny_rs232_tx is
signal shift_reg  : std_logic_vector(9 downto 0) := (others => '1');
signal i_busy     : std_logic;

begin
    busy <= i_busy;
    with shift_reg select i_busy <= '0' when "0000000000", '1' when others;

clk_proc: process(clk)
begin
    if rising_edge(clk) then
        if i_busy = '0' and data_enable = '1' then
            shift_reg <= '1' & data & '0';
        end if;            

        if bit_tick = '1' then
            if i_busy = '1' then
                tx <= shift_reg(0);
                shift_reg <= '0' & shift_reg(9 downto 1);
            end if;
        end if;
    end if;
end process;
end Behavioral;[/code]
发表于 2017-12-22 16:10:12 | 显示全部楼层
This is small module, do not waste your time just for improving some lines of code =))
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-3-29 06:36 , Processed in 0.016500 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表