Thursday, March 07, 2013

AND 邏輯閘測試


/////////////////
//行為模式
/////////////////


module top
  integer ia,ib;
  reg  a,b;
  wire out;

  and_behavioral and1(out,a,b);

  initial
    begin
      for (ia=0; ia<=1; ia = ia+1)
        begin
          a = ia;
          for (ib=0; ib<=1; ib = ib + 1)
            begin
              b = ib;
              #1 $display("a=%d b=%d out=%d",a,b,out);
            end
        end
    end
endmodule

module and_behavioral(out,a,b);
  input a,b;
  output out;
  wire a,b;
  reg out;

  always @(a or b)
    out = a & b;
endmodule



/////////////////
//結構模式
/////////////////
module top;

wire A, B, OUT
system_clock #400 clock1(A);
system_clock #200 clock2(B);

and a1(OUT, A, B);

endmodule

module system_clock(clk);
parameter PERIOD=100;
output clk;
reg clk;

initial clk=0;

always
 begin
#(PERIOD/2) clk=~clk;
 end

always@(posedge clk)
 if($time>1000)$stop;

endmodule



101-下__從C語言轉Verilog設計到FPGA晶片實現


Compile Your C code into Verilog

C-to-Verilog is a free and open sourced on-line C to Verilog compiler. You can copy-and-paste your existing C code and our on-line compiler will synthesize it into optimized verilog.
For additional information on how to use our website to create FPGA designs.


http://www.c-to-verilog.com

請101-下學期(102年3月)修課同學在這個訊息下, 留下自己的部落格網址....


為方便評估同學學習成效, 請在這個訊息下回POST, 留下自己的部落格網址....

回覆意見 comment 格式如下:

學號, 名字(後兩字), 網址例如:
S950001, XX, http:///????.blogspot.tw

謝謝合作.......

還沒有部落格帳號的同學, 請到 http://www.blogger.com 以 google (gmail) 帳號申請即可.