急!!!如何取得DEVICE DNA。

[复制链接]
5495|8
 楼主| ywert000 发表于 2013-2-21 19:31 | 显示全部楼层 |阅读模式
小弟最近才接触SPARTAN-3A系列开发项目。眼下要做一个XC3S50A的方案,需要做一个跟DEVICE DNA相关联的子程序,但从ISE 9.1里并没有找到获取DEVICE DNA的方法。 IMPACT工具里也没有啊。 急求各位FPGA高手指点,如何获得XC3X50A的DEVICE DNA。
 楼主| ywert000 发表于 2013-2-21 19:31 | 显示全部楼层
急求,在线等。谢谢。
strouledfox 发表于 2013-2-21 19:50 | 显示全部楼层
。。。。。。等吧 我不懂
qingniao929 发表于 2013-2-22 09:43 | 显示全部楼层
DNA好像在impact里面可以直接读出来
yuxhuitx 发表于 2013-2-23 20:50 | 显示全部楼层
IMPACT读不出来,自己产生控制时序调用DNA_PORT读出;网上有代码google一下
ifpga 发表于 2013-2-25 11:33 | 显示全部楼层
给你一个很久很久以前,写的一个读 DNA_ID 的模块

`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:    11:41:00 11/02/2010
// Design Name:
// Module Name:    dna
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////

`define        S0                 2'b00
`define        S1                2'b01
`define        S2                2'b10
`define        S3                2'b11


module dna(
    input clk,
         input reset,
    output [56:0] dout
    );


//wire [56:0] dout;
wire dout_c;
reg read, shift, din;
reg [6:0] count;
reg [1:0] next_state, current_state;
reg [56:0] dna_id;

localparam S_IDLE = `S0, S_READ = `S1, S_SHIFT = `S2, S_WRITE = `S3;

assign dout = (current_state == S_WRITE) ? dna_id : dout;


// 同步时序,描述次状态寄存器转移到现态寄存器
always @(posedge clk or posedge reset) begin
        if(reset)
                current_state <= S_IDLE;
        else
                current_state <= next_state;
end

// 产生下一个状态的组合逻辑(只与输入和当前状态有关)
always @(current_state or count) begin
        next_state = 2'bxx;        // 要初始化,使得系统复位后能进入正确的状态
        case (current_state)
                S_IDLE: begin
                        next_state = S_READ;
                end
               
                S_READ: begin
                        next_state = S_SHIFT;
                end

                S_SHIFT: begin
                        if(count == 57)
                                next_state = S_WRITE;
                        else
                                next_state = S_SHIFT;
                end
               
                S_WRITE: begin
                        next_state = S_IDLE;
                end

                default:
                        next_state = S_IDLE;
               
        endcase
end

// 同步时序,描述次态寄存器输出
always @(posedge clk or posedge reset) begin
        if(reset) begin
                read <= 0;
                shift <= 0;
                din <= 0;
                count <= 0;
        end
        else begin
                case(next_state)

                        S_IDLE: begin
                                read <= 0;
                                shift <= 0;
                                din <= 0;
                                count <= 0;
                        end

                        S_READ: begin
                                read <= 1;
                                shift <= 0;
                                din <= 0;
                                count <= 0;
                        end

                        S_SHIFT: begin
                                read <= 0;
                                shift <= 1;
                                count <= count + 1;
                        end
                       
                        S_WRITE: begin
                                read <= 0;
                                shift <= 0;
                        end

                        default: begin
                                read <= 0;
                                shift <= 0;
                                count <= 0;
                        end
                endcase
        end
end

// 同步时序,描述次态寄存器输出
always @(posedge clk or posedge reset) begin
        if(reset) begin
                dna_id <= 0;
        end
        else begin
                case(current_state)

                        S_SHIFT: begin
                                dna_id <= dna_id << 1;
                                dna_id[0] <= dout_c;
                        end
                       
                        S_WRITE: begin
                                dna_id <= dna_id;
                        end
                       
                        default: begin
                                dna_id <= 0;
                        end
                endcase
        end
end


DNA_PORT #(
        .SIM_DNA_VALUE(57'h1aaaaaaaaaaaaaa)
)dna_port_inst(
        .CLK(clk),
        .DIN(din),
        .DOUT(dout_c),
        .READ(read),
        .SHIFT(shift)
);


endmodule
nir 发表于 2013-2-25 13:48 | 显示全部楼层
不错。
pihois 发表于 2013-2-25 19:23 | 显示全部楼层
6# 的代码收藏了
qingniao929 发表于 2013-2-25 20:47 | 显示全部楼层
本帖最后由 qingniao929 于 2013-2-25 20:48 编辑

记错了,呵呵。spartan6的可以直接读出来.
DNA information is given in the respective Configuration user guide and the Device software library HDL user guide for the primitive.
For Spartan-3A series devices (Spartan-3A, Spartan-3AN and Spartan-3ANDSP)
   To read if the DNA iMPACT batch mode command is available. ("readDna -p <position>")
For Spartan-6 and Virtex-6 FPGA devices:
   A GUI option available in the iMPACT s/w under the "Process window", called "Read Device DNA". Also, the iMPACT batch mode command "readDna -p <position>"  will work.
For 7 series FPGA devices (Artix-7, Kintex-7 and ZynQ-7)
   Pre-iMPACT 14.4 does NOT have a GUI option available for READ DEVICE DNA in the iMPACT software under the "Process window". To get the Device DNA value read from the JTAG port, simply run the iMPACT batch mode command "readDna -p <position>"

6楼方法不错,Xilinx针对spartan3an的startkit也有一个参考设计用来读DNA,不过是EDK下的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

10

主题

155

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部