搜索
bottom↓
回复: 2

求把这几行代码转成VHDL!谢谢

[复制链接]

出0入0汤圆

发表于 2011-4-30 08:37:03 | 显示全部楼层 |阅读模式
module PDIUSBD12(     

           //Alvalon-MM Slave

           input           cpu_rd,

           input           cpu_wr,

           input           cpu_cs,

           input           cpu_addr,

           input [7:0]     cpu_wr_dat,

           output [7:0]    cpu_rd_dat,

           input [3:0]     cpu_be,

                     

                     //Conduit End         

                     //pdiusbd12 interface

                     output          d12_rd,

                     output          d12_wr,

                     output          d12_cs,

                     output          d12_addr,

                     inout [7:0]     d12_dat

);





/*****************************************/

assign     d12_rd = cpu_rd | cpu_be[0];

assign     d12_wr = cpu_wr | cpu_be[0];

assign     d12_cs = cpu_cs;

assign     d12_addr = cpu_addr;

assign     d12_dat = (!d12_cs && !d12_wr) ? cpu_wr_dat : 8'hzz;

assign     cpu_rd_dat = (!cpu_cs && !cpu_rd) ? d12_dat : 8'hzz;



endmodule

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

发表于 2011-4-30 16:05:27 | 显示全部楼层
library ieee;
use ieee.std_logic_1164.all;

entity PDIUSBD12 is
port(
     --Alvalon-MM Slave
     cpu_rd : in std_logic;
     cpu_wr : in std_logic;
    cpu_cs : in std_logic;
         cpu_addr : in std_logic;
         cpu_wr_dat : in std_logic_vector(7 downto 0);
         cpu_rd_dat : out std_logic_vector(7 downto 0);
         cpu_be : in std_logic_vector(3 downto 0);
         
         --Conduit End         
         --pdiusbd12 interface
         d12_rd : out std_logic;
         d12_wr : buffer std_logic;
         d12_cs : buffer std_logic;
         d12_addr : out std_logic;
         d12_dat : inout std_logic_vector(7 downto 0)
         );
end;

architecture behav of PDIUSBD12 is
begin

d12_rd <= cpu_rd or cpu_be(0);

d12_wr <= cpu_wr or cpu_be(0);

d12_cs <= cpu_cs;

d12_addr <= cpu_addr;

d12_dat <=  cpu_wr_dat when(not(d12_cs) and not(d12_wr)) = '1' else
            null;

cpu_rd_dat <= d12_dat when(not(cpu_cs) and not(cpu_rd)) = '1' else
            null;
end;
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-24 15:23

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表