實驗現象:
開啟tool-->Netlist viewer-->RTL viewer可觀察各個邏輯連線
核心程式碼:
//--------------------module_logic_gates---------------------// module logic_gates( input clk_25m, output c, output d, output e, output f, output g, output h, output i, output j, output k, output l ); //--------------------logic_gates_ctrl----------------------// reg [9:0]b; //產生輸入訊號b always@(posedge clk_25m) if(b == 10'd1000) b <= 10'd0; else b <= b + 1'd1; reg [7:0]a; //產生輸入訊號a always@(posedge clk_25m) if(a == 8'd500) a <= 8'd0; else a <= a + 1'd1; assign c = a[7] && b[9]; //邏輯與 assign d = a[7] || b[9]; //邏輯或 assign e = !a[7]; //邏輯非 assign f = a[7] & b[9]; //按位與 assign g = a[7] | b[9]; //按位或 assign h = ~a[7]; //按位非 assign i = a[7] &~ b[9]; //按位與非 assign j = a[7] |~ b[9]; //按位或非 assign k = a[7] ^ b[9]; //按位異或 assign l = a[7] ~^ b[9]; //按位同或 //--------------------endmodule---------------------------// endmodule
原始碼下載連結:
連結:http://pan.baidu.com/s/1mi5fZy4 密碼:mqcz
iCore4連結: