lua script를 이용한 logic 심볼 만들기



※ AND Gate


function _ontask()

if(input1 == true and input2 == true) then

output = true

else

output = false

end

end


※ OR Gate

function _ontask()

if(input1 == false and input2 == false) then

output = false

else

output = true

end

end


※ NAND Gate

function _ontask()

if(input1 == true and input2 == true) then

output = false

else

output = true

end

end


※ NOR Gate


function _ontask()
if(input1 == false and input2 == false) then
output = true
else
output = false
end
end

※ XOR Gate


function _ontask()
local icount = 0
if(input1 == true) then
icount = icount + 1
end
if(input2 == true) then
icount = icount + 1
end
if(icount%2 ~= 0) then
output = true
else
output = false
end
end

※ XNOR Gate

function _ontask()
local icount = 0
if(input1 == true) then
icount = icount + 1
end
if(input2 == true) then
icount = icount + 1
end
if(icount%2 ~= 0) then
output = false
else
output = true
end
end

※ INVERTOR Gate

function _ontask()

if(input == false) then

output = true

elseif(input == true) then

output = false

end

end


※ BUFFER Gate

function _ontask()

if(input == false) then

output = true

elseif(input == true) then

output = false

end

end


※ 3 STATE BUFFER Gate

function _ontask()

if(state == true) then

if(input == true) then

output = true

elseif(input == false) then

output = false

end

elseif(state == false) then

output = false

end

end


※ MUX Gate



function _ontask()
if(select1 == false) then
output = input1
elseif(select1== true) then
output = input2
end
end

※ HALF ADDER Gate


function _ontask()
local icount = 0
if(x_value == true) then
icount = icount + 1
end
if(y_value == true) then
icount = icount + 1
end
if(icount%2 ~= 0) then
s_value = true
else
s_value = false
end
if(x_value == true and y_value == true) then
c_value = true
else
c_value = false
end
end

※ HALF SUBTRACTOR Gate


function _ontask()
local icount = 0
if(x_value == true) then
icount = icount + 1
end
if(y_value == true) then
icount = icount + 1
end
if(icount%2 ~= 0) then
d_value = true
else
d_value = false
end
if(x_value == false and y_value == true) then
b_value = true
else
b_value = false
end
end


※ 사용자가 제작한 심볼을 이용한 로직 프로세싱.


다기능 그래픽 솔루션 : enuSpace 이엔유 주식회사 



+ Recent posts