|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
部分代码如下:【需要的话,请到本贴购买】
http://www.eetop.cn/bbs/viewthread.php?tid=39573&extra=page%3D1
`timescale 1 ns / 10 ps
//`define PCMCIA_TEST
//`define SCI_TEST
`define TSI_TEST
module mcu_model
(
input sys_clk,
input int,
input avalon_req,
input [63:0] cw,
input [7:0] table_id,
input [15:0] pid,
input [4:0] index,
output reg [7:0] ts_ctrl,
output reg mcu_cs,
output reg mcu_wr,
output reg mcu_rd,
input mcu_ack,
output reg [15:0] mcu_addr,
output reg [7:0] mcu_wrdat,
input [7:0] mcu_rddat
);
reg bus_busy=0;
//reg [7:0] ts_ctrl;
integer sec_ch0;
task mcu_write;
input [15:0] wraddr;
input [7:0] wrdat;
begin
wait ( bus_busy == 1'b0 );
bus_busy = 1'b1;
@ ( posedge sys_clk )
begin
mcu_wr = 1'b0;
mcu_cs = 1'b0;
mcu_addr = wraddr;
mcu_wrdat = wrdat;
end
@ ( posedge sys_clk )
begin
............................................
// test demux buffer
addr = 8'h00;
for ( i=0; i<32; i=i+1 )
begin
mcu_write( {4'he,`demux_base,`pid_scope, 8'h00} , 8'hff );
mcu_write( {4'he,`demux_base,`pid_scope, 8'h01} , 8'h1f|8'h60 ); // enable desc & sec
mcu_write( {4'he,`demux_base,`pid_scope, 1'b1,2'b00, addr[4:0]} , 8'h01 ); // set PID
addr = addr + 1'b1;
end
// configuation demux
mcu_write( {4'he,`demux_base,`reg_scope, 8'h00} , 8'h01 ); //set alpas (msb) to be '0' and auto (lsb) to be '1'
mcu_write( {4'he,`demux_base,`pid_scope, 8'h00} , 8'ha0 );
mcu_write( {4'he,`demux_base,`pid_scope, 8'h01} , 8'h00 );
mcu_write( {4'he,`demux_base,`pid_scope, 8'h85} , 8'h01 ); // channel 5, pid = 00a0
*/
ts_ctrl <= 8'h87; // Tuner send enable
# 200000;
//$fsdbDumpflush;
//$finish();
end
`endif
endmodule
[ 本帖最后由 wice3 于 2007-1-12 21:40 编辑 ] |
|