Wednesday, September 16, 2015

Verilog 課程簡介


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

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

回覆意見 comment 格式如下:學號, 名字(後兩字), 網址

例如: S030001, 佩儒, http:///yourname.blogspot.com

謝謝合作........

Monday, September 22, 2014

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

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

回覆意見 comment 格式如下:學號, 名字(後兩字), 網址

例如: S030001, 浩雲, http:///yourname.blogspot.com

謝謝合作........

Thursday, March 20, 2014

1位元多工器 邏輯閘測試

/////////////////
//行為模式
/////////////////
module top;
  integer ia,ib,is;
  reg  a,b,s
  wire out;

  mux_behavioral mux1(out,a,b,s);

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

module mux_behavioral(OUT, A, B, SEL);
 output OUT;
 input A,B,SEL;
 wire  A,B,SEL;
 reg    OUT;

  always @(A or B or SEL)
   OUT = (A & SEL)|(B & ~SEL );
endmodule

/////////////////
//結構模式
/////////////////
module top
  integer ia,ib,is;
  reg  a,b,s;
  wire out;

  mux_structural mux1(out,a,b,s);

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

module mux_structural(OUT, A, B, SEL);
 output OUT;
 input A,B,SEL;
 not I5 (sel_n, SEL);
 and I6 (sel_a, A, SEL);
 and I7 (sel_b, sel_n, B);
 or I4 (OUT, sel_a, sel_b);
endmodule

Monday, June 17, 2013

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

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

回覆意見 comment 格式如下:學號, 名字(後兩字), 網址

例如: S950001, 曉明, http:///yourname.blogspot.com

謝謝合作........

Thursday, April 25, 2013

一位元加法器行為模式設計與測試

module test_adder1;

 reg a,b;
 reg carry_in ;
 wire sum;
 wire carry_out;

 adder1_behavorial A1(carry_out, sum, a, b, carry_in);

 initial
  begin

    carry_in = 0; a = 0; b = 0;
    # 100 if ( carry_in != 0 | sum !== 0)
                $display(" 0+0+0=00 sum is WRONG!");
              else
                $display(" 0+0+0=00 sum is RIGHT!");
    carry_in = 0; a = 0; b = 1;
    # 100 if ( carry_in != 0 | sum !== 1)
               $display(" 0+0+1=01 sum is WRONG!");
              else
               $display(" 0+0+1=01 sum is RIGHT!");
    carry_in = 1; a = 1; b = 1;
    # 100 if ( carry_in != 1 | sum !== 1)
               $display(" 1+1+1=11 sum is WRONG!");
              else
               $display(" 1+1+1=11 sum is RIGHT!");
    $finish;
  end
endmodule



module adder1_behavorial (carry_out, sum, a, b, carry_in);
 input a, b, carry_in;
 output carry_out, sum;
  assign sum = (~a&b&~carry_in)|(~carry_in&a&~b)|(a&b&carry_in);
  assign carry_out = a&carry_in|a&b|b&carry_in;
endmodule

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) 帳號申請即可.