// Shaurya Goel
// 2016194
Q1
module q1(h,v,a,t,p);
input [1:0]t,p;
output h,v,a;
assign h=((~t[1])&(~t[0]))&(~(p[1]&p[0]));
assign v=((~p[1])&(~p[0]))&(~((~t[1])&(~t[0])));
assign a=(((~p[1])&(~p[0]))&((~t[1])&(~t[0])))|((p[1]&p[0])&(t[1]&t[0]));
endmodule
Behavioural model
module q1_behav(h,a,v,t,p);
input [1:0]t,p;
always @(*)
begin
h=1'b1;
else
h=1'b0;
end
always @(*)
begin
v=1'b1;
else
v=1'b0;
end
always @(*)
begin
if((p[1]==0 && p[0]==0 && t[1]==0 && t[0]==0 )||(p[1]==1 &&p[0]==1 && t[1]==1 && t[0]==1))
a=1'b1;
else
a=1'b0;
end
endmodule
Constraint File
Behavioural model
module lab_2_q2_behav(y,z,cost,t,useful,lec);
input useful,lec;
always @(*)
begin
z=1'b1;
z=1'b1;
else
z=1'b0;
end
always @(*)
begin
if(z==1'b1)
y=1'b0;
else if((cost[1]==0) && (cost[0]==0) && (t[1]==0) && (t[0]==0) && (useful==0))
y=1'b1;
y=1'b1;
else
y=1'b0;
end
endmodule
Data Flow Model
module lab_2_q_2_data_flow(y,z,cost,t,useful,lec );
input useful,lec;
output y,z;
assign z=((~cost[1])&(~cost[0])&(useful))|(useful&(cost[1]|cost[0]));
assign y=(~z)&(((~cost[1])&(~cost[0])&(t[1])&(t[0])&(~useful))|((cost[1])&(cost[0])&(lec)&(t[1]|t[0])));
endmodule
Constraint File