I am trying to learn Structural Modelling. So in my library code, I have only "AND_gate" entity with 2 architecture. and_3 is my first architecture for 3 input and and_4 is the second architecture for 4 input.
I am trying to use them as components but I have a problem with configuration.
and_4 is analyzed last so AND1 and AND2 work without problem because they are using and_4.
So my problem is when I try to draw RTL Schematic, my project doesn't use AND3 and AND4. I need to configure and_3 architecture for them.
...
architecture Structure of Structural_Modelling is
component AND_gate is
Port ( INA1 : in STD_LOGIC;
INA2 : in STD_LOGIC;
INA3 : in STD_LOGIC;
INA4 : in STD_LOGIC;
OA : out STD_LOGIC);
end component;
for AND3 : AND_gate use entity work.AND_gate(and_3);
for AND4 : AND_gate use entity work.AND_gate(and_3);
signal wire1, wire2, wire3, wire4 : STD_LOGIC;
begin
AND1 : AND_gate port map (nx,y,t,nw,wire1);
AND2 : AND_gate port map (x,y,nt,nw,wire2);
AND3 : AND_gate port map (y,z,w,wire3);
AND4 : AND_gate port map (ny,nz,nw,wire4);
end Structure;
This is my VHDL code for components library:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity AND_gate is
Port ( INA1 : in STD_LOGIC;
INA2 : in STD_LOGIC;
INA3 : in STD_LOGIC;
INA4 : in STD_LOGIC;
OA : out STD_LOGIC);
end AND_gate;
architecture and_3 of AND_gate is
begin
OA <= INA1 and INA2 and INA3 ; -- 3 input AND gate
end and_3;
architecture and_4 of AND_gate is
begin
OA <= INA1 and INA2 and INA3 and INA4 ; -- 4 input AND gate
end and_4;
I found out it is not possible to instantiate from multiple architectures of a single entity. Instead of that another entity for the second architecture can be used.
Related
I've got a module that generates the following FIRRTL
module Deep_1 :
input clock : Clock
input reset : UInt<1>
output io : {in : {flip data : SInt<8>[4]}, constIn : {flip data : SInt<8>[4]}, ...}
...
... (elided)
...
wire inputData : SInt<8>[4] #[Deep.scala 32:23]
wire constInputData : SInt<8>[4] #[Deep.scala 33:28]
reg outputData : SInt<8>[4], clock #[Deep.scala 34:23]
inputData[2] <= io.in.data[2] #[Deep.scala 37:18]
constInputData[2] <= io.constIn.data[2] #[Deep.scala 38:23]
node _T_209 = add(inputData[2], constInputData[2]) #[package.scala 32:44]
node _T_210 = tail(_T_209, 1) #[package.scala 32:44]
node _T_211 = asSInt(_T_210) #[package.scala 32:44]
outputData[2] <= _T_211 #[Deep.scala 39:19]
...
... (elided)
...
but when I try to run my tests through the firrtl interpreter I get
Exception during evaluation: error: ConcreteSInt(303, 9) bad width 9 needs 10 #[package.scala 32:44:#82.4]
Expression Evaluation stack
0 dut.outputData_2:Reg -> dut._T_211
1 dut._T_211:Node -> asSInt(dut._T_210)
2 dut._T_210:Node -> tail(dut._T_209, 1)
3 dut._T_209:Node -> add(dut.inputData_2, dut.constInputData_2)
If I understand this correctly, it is saying that the width of outputData[2] is 9 but 10 is needed. However, from what I can see, the width of both outputData[2] and _T_211 should be 8, the first by definition and the second as a result of the add() and tail() operations applied.
What am I missing?
How current is your software? I cannot reproduce the problem with current versions of the interpreter. I used the following firrtl test in the gist Attempt to reproduce firrtl-interpreter width error where I un-elided. As #Kamyar said, can you try using the Treadle backend. It is more modern and better supported at this point than is the interpreter.
I'm using this function snippet to make my 7 segment display more readable. Why does it print '00' and not '0E'?
module main;
function disp;
input [6:0] a;
begin
case (a)
7'b0000001 : disp=4'h0;
7'b1001111 : disp=4'h1;
7'b0010010 : disp=4'h2;
7'b0000110 : disp=4'h3;
7'b1001100 : disp=4'h4;
7'b0100100 : disp=4'h5;
7'b0100000 : disp=4'h6;
7'b0001111 : disp=4'h7;
7'b0000000 : disp=4'h8;
7'b0001100 : disp=4'h9;
7'b0001000 : disp=4'hA;
7'b1100000 : disp=4'hB;
7'b0110001 : disp=4'hC;
7'b1000010 : disp=4'hD;
7'b0110000 : disp=4'hE;
7'b0111000 : disp=4'hF;
default : disp=4'bxxxx;
endcase
end
endfunction
initial
begin
$display("%h%h", disp(7'b0000001), disp(7'b0110000)); //expecting 0E
$finish;
end
endmodule
You are missing the size of the output from the function. It defaults to 1 bit and because the first bit of 'hE is 0 it returns zero.
Change the function declaration to:
function [3:0] disp;
I am working on parsing JSON CLOB in oracle. I am trying to retrieve and parse individual JSON elements.
Main issue I isolated is that compiler is unable recognize the JSON type here. However, I am able to insert and access individual JSON elements in the po_document field(declared as CLOB). This is the JSON I am trying to access
'{"PONumber" : 1600,
"Reference" : "ABULL-20140421",
"Requestor" : "Alexis Bull",
"User" : "ABULL",
"CostCenter" : "A50",
"ShippingInstructions" : "no such",
"Special Instructions" : null,
"AllowPartialShipment" : true,
"LineItems" : "no line"}'
I just took a standard Pl/SQL block to parse the JSON object:
DECLARE
vCONTENT CLOB;
v_parent_json json;
v_json_message_list json_list;
v_json_message_list_value json_value;
v_parent_json_value json_value;
BEGIN
SELECT po_document INTO vCONTENT FROM j_purchaseorder;
v_parent_json := json(vCONTENT);
v_parent_json := json(v_parent_json.get(1));
v_json_message_list := json_list(v_parent_json.get('LineItems'));
DBMS_OUTPUT.PUT_LINE(v_json_message_list.count);
for message_loop_counter in 1 ..v_json_message_list.count loop
v_parent_json_value := json(v_json_message_list.get(message_loop_counter)).get(1);
DBMS_OUTPUT.PUT_LINE(v_parent_json_value.mapname);
END LOOP;
END;
The compiler log generates the error message: Error(3,8): PLS-00201: identifier 'JSON' must be declared
Output from v$version:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
I was trying different things initially. I was using PL/JSON functions in my questions but if I want to use Oracle functions, this could be a small demo to read JSON and print values:
declare
l_has_data_level_co BOOLEAN := FALSE; -- TRUE is for R12C
jdemo CLOB;
l_name varchar2(2000):='';
l_location varchar2(2000):='';
begin
jdemo := '{"PONumber" : 1600,
"Reference" : "ABULL-20140421",
"Requestor" : "Alexis Bull",
"User" : "ABULL",
"CostCenter" : "A50",
"ShippingInstructions" : "no such",
"Special Instructions" : null,
"AllowPartialShipment" : true,
"LineItems" : "no line"}';
SELECT
json_value(jdemo, '$.PONumber'),
json_value(jdemo, '$.Reference')
into
l_name,
l_location
FROM dual;
--DBMS_OUTPUT.PUT_LINE (SYSDATE||' '||jdemo);
DBMS_OUTPUT.PUT_LINE ('Name :'||l_name||' Location :'||l_location);
end;
I am doing develop Indy based application.
Server has several Indy TCP Server components.
So It works under multi-threads and handles mysql db.
I have faced one problem.
That is about the exceptions of MySQL DB in threads.
When serveral threads attack to same db table, then It says me like follows
UniQuery_Mgr: Duplicate field name 'id'
UniQuery_Mgr: Field 'grp_id' not found //of course grp_id field is really existed.
Assertion failure (C:\Program Files (x86)\unidac539src\Source\CRVio.pas, line 255)
Commands out of sync; You can't run this command now
ReceiveHeader: Net packets out of order: received[0], expected[1]
UniQuery_Mgr: Cannot perform this operation on a closed dataset
How to do I ? UniQuery_Mgr is TUniQuery component.
and my query handling code is normally like this
Code 1
sql := 'SELECT * FROM data_writed;';//for example
UniQuery_Mgr.SQL.Clear;
UniQuery_Mgr.SQL.Add(sql);
UniQuery_Mgr.ExecSQL;
Code 2
try
sql := 'SELECT * FROM gamegrp_mgr;';
UniQuery_Mgr.SQL.Clear;
UniQuery_Mgr.SQL.Add(sql);
UniQuery_Mgr.ExecSQL;
if UniQuery_Mgr.RecordCount > 0 then
begin
MAX_GAME_GROUP_COUNT := UniQuery_Mgr.RecordCount + 1;
UniQuery_Mgr.First;
i := 1;
while not UniQuery_Mgr.Eof do
begin
Game_Group_ID[i] := UniQuery_Mgr.FieldByName('grp_id').AsInteger;
Game_Game_ID[i] := UniQuery_Mgr.FieldByName('game_id').AsInteger;
UniQuery_Mgr.Next;
Inc(i);
end;
end;
except
on E : Exception do
begin
EGAMEMSG := Format('GAME group read error: <%s> # %s',[ E.ToString, DateTimeToStr(now)]);
Exit;
end;
end;
Code 3
try
sql := 'UPDATE data_writed SET write_gamegrp = ' + QuotedStr('0') + ';';
UniQuery_Mgr.SQL.Clear;
UniQuery_Mgr.SQL.Add(sql);
UniQuery_Mgr.ExecSQL;
except
on E : Exception do
begin
EGAMEMSG := Format('data updating error: <%s> # %s',[ E.ToString, DateTimeToStr(now)]);
Exit;
end;
end;
My handling DB components is bad ? Other thread-safe method is existed???
I'm using SmartGWT -4.0 and tried to run the example of using DataSource with Json , RestDataSourceWithJson.zip .
but the development mode console returns me the following error :
[ ERROR ] [ restdatasourcewithjson ] 10:55:28.214 : XRP4 : WARN : RPCManager : performTransactionReply : No such transaction 0
com.smartgwt.client.core.JsObject $ SGWT_WARN : 10:55:28.214 : XRP4 : WARN : RPCManager : performTransactionReply : No such transaction 0
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0 ( Native Method )
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce ( NativeConstructorAccessorImpl.java : 57)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance ( DelegatingConstructorAccessorImpl.java : 45)
at java.lang.reflect.Constructor.newInstance ( Constructor.java : 525 )
at com.google.gwt.dev.shell.MethodAdaptor.invoke ( MethodAdaptor.java : 105)
at com.google.gwt.dev.shell.MethodDispatch.invoke ( MethodDispatch.java : 71)
at com.google.gwt.dev.shell.OophmSessionHandler.invok e ( OophmSessionHandler.java : 172)
at com.google.gwt.dev.shell.BrowserChannelServer.reac tToMessages ( BrowserChannelServer.java : 293)
at com.google.gwt.dev.shell.BrowserChannelServer.proc essConnection ( BrowserChannelServer.java : 547)
at com.google.gwt.dev.shell.BrowserChannelServer.run ( BrowserChannelServer.java : 364 )
at java.lang.Thread.run ( Thread.java : 722 )
this happens to any other project that uses json .
has anyone had this error ?
thanks for the help .
I have been getting this too when running a REST webapp using Smartgwt Datasources and XML messaging with Jersey, under Chrome. Other browsers don't throw this error.
You will get errors in that situation because running a Smartgwt app under Chrome is not supported (albeit sometimes useful to check what your CSS looks like), so I would just say use another browser for dev mode.
Source:
Smartgwt user guide, and this thread: http://forums.smartclient.com/showthread.php?t=30289