Files
TBgen_App/prompt_scripts/__pycache__/script_pychecker_SEQ.cpython-312.pyc

214 lines
32 KiB
Plaintext
Raw Normal View History

2026-03-30 16:46:48 +08:00
<EFBFBD>
P<>Yi]p<00><00>><00>dZddlmZmZddlmZddlmZddlmZddl Z Gd<08>d e<02>Z
Gd
<EFBFBD>d e<03>Z d Z d Z dZdZGd<10>de<03>Zd(dededefd<15>ZdZde <0C>de <0C>d<19>ZGd<1A>de<03>ZdZde zZGd<1E>de<03>Zd e zZd!Zd"Zd#ZGd$<24>d%e<03>ZGd&<26>d'e<03>Zy))z<>
Description : The prompt script for pychecker workflow
Author : Ruidi Qiu (r.qiu@tum.de)
Time : 2024/3/22 10:40:43
LastEdited : 2024/9/3 17:01:56
<EFBFBD>)<02>
BaseScript<EFBFBD>BaseScriptStage)<01>script_RTLchecker0306)<01>utils)<01>given_TB<54>Nc<00><<00><00>eZdZdZdededef<06>fd<05> Zd<06>Zd<07>Z <09>xZ
S)<08>WF_pychecker_SEQz
WF_pychecker_SEQ
<20> prob_data<74>task_dir<69>configc<00><><00><01>t<00>|<00>|||<03>|jjjj
|_d|_d|_y)N<>T) <09>super<65>__init__r <00>autoline<6E> checklist<73>max<61>max_check_iter<65>py_code<64>py_debug_focus)<05>selfr r r <00> __class__s <20><>I/home/zhang/CorrectBench/TBgen_App/prompt_scripts/script_pychecker_SEQ.pyrzWF_pychecker_SEQ.__init__sA<00><><00> <0A><07><18><19>H<EFBFBD>f<EFBFBD>5<>"<22>k<EFBFBD>k<EFBFBD>2<>2<><<3C><<3C>@<40>@<40><04><1B><19><04> <0C>"<22><04><1B>c<00><><00>t|jfi|j<00><01>|_|j |j<00>t j |jfi|j<00><01>|_|j |j<00>t j|j|jjfi|j<00><01>|_
|j |j<00>t|j|jj|jjfi|j<00><01>|_ |j |j<00>t|j|jj|jjfi|j<00><01>|_|j |j<00>t|j |jj|j"fi|j<00><01>|_|j |j$<00>t'|j|j fi|j<00><01>|_|j |j(<00>t+|j|jj|jjfi|j<00><01>|_|j |j,<00>y)N)<17>Stage0r <00> gptkwargs<67>stage0<65>stage_operationr<00>Stage1<65>stage1<65>Stage2<65>response<73>stage2<65>Stage3<65>stage3<65>
Stage4_SEQ<EFBFBD>stage4<65>StageChecklist<73>TB_coder<00>
stagecheck<EFBFBD> Stage4b_SEQ<45>stage4b<34>
Stage5_SEQ<EFBFBD>stage5<65>rs r<00>make_and_run_stagesz$WF_pychecker_SEQ.make_and_run_stagess<><00><00><1C>T<EFBFBD>^<5E>^<5E>><3E>t<EFBFBD>~<7E>~<7E>><3E><04> <0B> <0C><1C><1C>T<EFBFBD>[<5B>[<5B>)<29>+<2B>2<>2<>4<EFBFBD>><3E>><3E>T<>T<EFBFBD>^<5E>^<5E>T<><04> <0B> <0C><1C><1C>T<EFBFBD>[<5B>[<5B>)<29>+<2B>2<>2<>4<EFBFBD>><3E>><3E>4<EFBFBD>;<3B>;<3B>CW<43>CW<43>j<>[_<>[i<>[i<>j<><04> <0B> <0C><1C><1C>T<EFBFBD>[<5B>[<5B>)<29><1C>T<EFBFBD>^<5E>^<5E>T<EFBFBD>[<5B>[<5B>-A<>-A<>4<EFBFBD>;<3B>;<3B>CW<43>CW<43>j<>[_<>[i<>[i<>j<><04> <0B> <0C><1C><1C>T<EFBFBD>[<5B>[<5B>)<29> <20><14><1E><1E><14><1B><1B>1E<31>1E<31>t<EFBFBD>{<7B>{<7B>G[<5B>G[<5B>n<>_c<5F>_m<5F>_m<5F>n<><04> <0B> <0C><1C><1C>T<EFBFBD>[<5B>[<5B>)<29>(<28><14><1C><1C>t<EFBFBD>{<7B>{<7B>7K<37>7K<37>T<EFBFBD>M`<60>M`<60>s<>dh<64>dr<64>dr<64>s<><04><0F> <0C><1C><1C>T<EFBFBD>_<EFBFBD>_<EFBFBD>-<2D>"<22>4<EFBFBD>><3E>><3E>4<EFBFBD><<3C><<3C>R<>4<EFBFBD>><3E>><3E>R<><04> <0C> <0C><1C><1C>T<EFBFBD>\<5C>\<5C>*<2A> <20><14><1E><1E><14><1B><1B>1E<31>1E<31>t<EFBFBD>{<7B>{<7B>G[<5B>G[<5B>n<>_c<5F>_m<5F>_m<5F>n<><04> <0B> <0C><1C><1C>T<EFBFBD>[<5B>[<5B>)rc<00>p<00>|jdk(<00>rt|j|jj|j
jfi|j <00><01>|_|j|j|d<02><03>t|j|j
j|jfi|j <00><01>|_ |j|j|d<02><03>t|j|jfi|j <00><01>|_|j|j|d<02><03>y|jdk(rnt|j|jj|j jfi|j <00><01>|_|j|j"|d<02><03>yt%d<05><00>)N<>TBT)<01> reboot_en<65>PYz>invalid reboot_mode in WF_pychecker script (circuit type: SEQ))<13> reboot_moder(r r"r$r%rr)r r*r+rr,r-r.r/r'r0<00>
ValueError)r<00> debug_dirs r<00>make_and_run_reboot_stagesz+WF_pychecker_SEQ.make_and_run_reboot_stages4sF<00><00> <0F> <1B> <1B>t<EFBFBD> #<23>$<24>T<EFBFBD>^<5E>^<5E>T<EFBFBD>[<5B>[<5B>5I<35>5I<35>4<EFBFBD>;<3B>;<3B>K_<4B>K_<4B>r<>cg<63>cq<63>cq<63>r<>D<EFBFBD>K<EFBFBD> <10> <20> <20><14><1B><1B>i<EFBFBD>4<EFBFBD> <20> H<>,<2C>T<EFBFBD>\<5C>\<5C>4<EFBFBD>;<3B>;<3B>;O<>;O<>QU<51>Qd<51>Qd<51>w<>hl<68>hv<68>hv<68>w<>D<EFBFBD>O<EFBFBD> <10> <20> <20><14><1F><1F>)<29>t<EFBFBD> <20> L<>&<26>t<EFBFBD>~<7E>~<7E>t<EFBFBD>|<7C>|<7C>V<>t<EFBFBD>~<7E>~<7E>V<>D<EFBFBD>L<EFBFBD> <10> <20> <20><14><1C><1C>y<EFBFBD>D<EFBFBD> <20> I<> <11> <1D> <1D><14> %<25>$<24>T<EFBFBD>^<5E>^<5E>T<EFBFBD>[<5B>[<5B>5I<35>5I<35>4<EFBFBD>;<3B>;<3B>K_<4B>K_<4B>r<>cg<63>cq<63>cq<63>r<>D<EFBFBD>K<EFBFBD> <10> <20> <20><14><1B><1B>i<EFBFBD>4<EFBFBD> <20> H<><1C>]<5D>^<5E> ^r) <0B>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__<5F>dict<63>str<74>objectrr2r:<00> __classcell__<5F>rs@rr
r
s-<00><><00><08>#<23><14>#<23><03>#<23>F<EFBFBD>#<23> *<2A>6_rr
c<00>,<00><00>eZdZd<04>fd<01> Zd<02>Zd<03>Z<05>xZS)rc <00>@<00><01>t<00>|<00>di|<02><01>||_d|_y)N)<01>stage_0)rrr <00> circuit_type)rr rrs <20>rrzStage0.__init__Gs"<00><><00> <0A><07><18>0<>i<EFBFBD>0<>"<22><04><0E> <20><04>rc<00><00>|jd<01>|jd<02>|j|jd<00>|jd<04>|j|jd<00>|jd<06>y)NzcPlease generate the verilog RTL code according to the following description and header information:zproblem description:<3A> descriptionz RTL header:<3A>headerz0please only reply verilog codes, no other words.)<02>add_prompt_liner r1s r<00> make_promptzStage0.make_promptLsq<00><00> <0C><1C><1C>C<02> D<02> <0C><1C><1C>3<>4<> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>M<EFBFBD>:<3A>;<3B> <0C><1C><1C>]<5D>+<2B> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>H<EFBFBD>5<>6<> <0C><1C><1C>O<>Prc<00><><00>|j|jd<01>d|_tj|j<00>|_y<00>N<>verilog<6F><67><EFBFBD><EFBFBD><EFBFBD>)<05> extract_coder$r<00>circuit_type_by_coderGr1s r<00>postprocessingzStage0.postprocessingTs6<00><00><1C>)<29>)<29>$<24>-<2D>-<2D><19>C<>B<EFBFBD>G<><04> <0A>!<21>6<>6<>t<EFBFBD>}<7D>}<7D>E<><04>r<00><02>returnN<6E>r;r<r=rrLrSrBrCs@rrrFs<00><><00>!<21>
Q<01>Frrz/* SIGNAL TEMPLATE 1 */z/* SIGNAL TEMPLATE 1A */z/* SIGNAL TEMPLATE 1B */a<>1. Your task is to write a verilog testbench for an verilog RTL module code (we call it as "DUT", device under test). The information we have is the problem description that guides student to write the RTL code (DUT) and the header of the "DUT". Our target is to generate the verilog testbench for the DUT. This testbench can check if the DUT in verilog satisfies all technical requirements of the problem description.
2. you are in stage 3; in this stage, please give me the core rules of an ideal DUT. you should give these rules in python. (For convenience, you can use binary or hexadecimal format in python, i.e. 0b0010 and 0x1a). Later we will use these ideal rules to generate expected values in each test scenario. currently you must only generate the core part of the rules. the input of these rules should be related to the test vectors from test scenario. the rule should give the expected values under test vectors. You don't need to consider the control signals like clk or reset, unless the core rules of this task are about these signals. You can use numpy, scipy or other third party python libraries to help you write the rules. Please import them if you need.
3. your information is:c<00>,<00><00>eZdZd<04>fd<01> Zd<02>Zd<03>Z<05>xZS)r&c <00>d<00><01>t<00>|<00>di|<04><01>||_||_||_t
|_y)N)<01>stage_3)rrr <00>response_stage1<65>response_stage2<65> STAGE3_TXT1<54>txt1)rr rZr[rrs <20>rrzStage3.__init__as1<00><><00> <0A><07><18>0<>i<EFBFBD>0<>"<22><04><0E>.<2E><04><1C>.<2E><04><1C><1F><04> rc<00><><00>d|_|j|j<00>|jd<02>|j|jd<00>|jd<04>|j|j<00>|jd<05>|j|jd<00>|jd<07>|j|j
<00>|jd<08>y) Nr<00> RTL circuit problem description:rIzRTL testbench specification:<3A> DUT header:rJzqtest scenario: (please note the test vectors below, it will help you determine the input parameters of the rules)z<>your response should only contain python code. For convenience, you can use binary or hexadecimal format in python. For example: 0b0010 and 0x1a)<06>promptrKr]r rZr[r1s rrLzStage3.make_prompths<><00><00><18><04> <0B> <0C><1C><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>'<27> <0C><1C><1C>?<3F>@<40> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>M<EFBFBD>:<3A>;<3B> <0C><1C><1C>;<3B><<3C> <0C><1C><1C>T<EFBFBD>1<>1<>2<> <0C><1C><1C>]<5D>+<2B> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>H<EFBFBD>5<>6<> <0C><1C><1C>Q<02> R<02> <0C><1C><1C>T<EFBFBD>1<>1<>2<> <0C><1C><1C>p<02> qrc<00>l<00>|j|jd<01>}d}|D]
}||dzz }<02> ||_y)N<>pythonr<00>
)rQr$)r<00> python_codesr$<00> python_codes rrSzStage3.postprocessingzsB<00><00><1B>(<28>(<28><14><1D><1D><08>A<> <0C><15><08>'<27> +<2B>K<EFBFBD> <14> <0B>d<EFBFBD>*<2A> *<2A>H<EFBFBD> +<2B> <20><04> rrTrVrCs@rr&r&`s<00><><00> <20>q<02>$!rr&rJ<00>template_scenario_idx<64> signal_valuec<00><00>|jd<01>djd<03>djd<05>}|D<00>cgc]$}|j<00>jd<06>d<00><02>&}}d|z}|D] }|d |<04>d
|<02><00>z }<05>|Scc}w) ae
- header: the header of DUT
- template_scenario_idx: the scenario index in the template
- signal_value: the value of the signal in the template
- only: None: both input signal and output signal; "input": only input signal; "output": only output signal
- from header to signals in txt
- for the automatic generation of signals in testbench
- target: given the DUT header, generate the signal output template
- eg: if we have a DUT header like "module DUT(input a, b, c, output d, e);", the signal output template should be like "scenario: 1, a = 1, b = 0, c = 1, d = 0, e = 0"
<20>(r<00>)r<00>,<2C> rPz
scenario: <20>, <20> = )<02>split<69>strip)rJrgrh<00>signals<6C>signal<61>
signal_outs r<00>header_to_SignalTxt_templateru<00>s<><00><00><15>l<EFBFBD>l<EFBFBD>3<EFBFBD><1F><01>"<22>(<28>(<28><13>-<2D>a<EFBFBD>0<>6<>6<>s<EFBFBD>;<3B>G<EFBFBD>;B<>C<><16>v<EFBFBD>|<7C>|<7C>~<7E>#<23>#<23>C<EFBFBD>(<28><12>,<2C>C<>G<EFBFBD>C<><1D> 5<>5<>J<EFBFBD><19>5<><06><12><02>6<EFBFBD>(<28>#<23>l<EFBFBD>^<5E>4<>4<>
<EFBFBD>5<> <15><15><> Ds<00>)A>a
1. Your task is to complete a given verilog testbench code. This testbench is for a verilog RTL module code (we call it as "DUT", device under test). This circuit is a sequential circuit. The infomation we have is
- 1.1. the problem description that guides student to write the RTL code (DUT) and the header of the "DUT".
- 1.2. the module header.
- 1.3. test scenarios which determines values and sequential information of test vectors
- 1.4. the testbench structure
- 1.5. the instruction of writing our testbench
z<EFBFBD>
The testbench does not need to check the DUT's output but only export the signals of DUT. Please export the signals of DUT to a file named "TBout.txt" at the end of each scenario. The template is given below:
a<EFBFBD>
The variables are already declared. The clock signal is already prepared. This output will be used to check the correctness of the DUT's output later.
please only use "#10" as the delay when you need. If you need longer delay, you can use multiple "#10", such as "#10; #10; #10;". Avoid meaningless long delay in your code.
If you need a loop in a scenario to check multiple time points, use "repeat" loop. for exmaple:
```
// scenario x
scenario = x;
signal_1 = 1;
repeat(5) begin
a<>
#10;
end
```
Please determine the input signal's exact values according to given test scenarios.
Note: please complete the last initial code part (marked in the given testbench template). You should give me the completed full code. The testbench template above is to help you generate the code. You must use %d when exporting values.
please generate the full testbench code. please only reply verilog codes, no other words.
c<00>H<00><00>eZdZdZd<07>fd<02> Zd<03>Zd<04>Zeddefd<06><05>Z <09>xZ
S) r(zNstage 4 (SEQ): generate the testbench that export the signals of DUT to a filec <00><><00><01>t<00>|<00>di|<04><01>||_||_||_|j |dd<02><03>}t |_tjt|<05>|_ t|d<00>|_ y)NrJT<><01>check_en)<01>stage_4)rrr rZr[ru<00>STAGE4_SEQ_TXT1r]<00>STAGE4_SEQ_TXT2<54>replace<63>SIGNALTEMP_PLACEHOLDER_1<5F>txt2r<00>TB_code_object)rr rZr[r<00>signals_output_templaters <20>rrzStage4_SEQ.__init__<5F>su<00><><00> <0A><07><18>0<>i<EFBFBD>0<>"<22><04><0E>.<2E><04><1C>.<2E><04><1C>"&<26>"C<>"C<>I<EFBFBD>h<EFBFBD>DW<44>bf<62>"C<>"g<><1F>#<23><04> <09>#<23>+<2B>+<2B>,D<>F]<5D>^<5E><04> <09>&<26>y<EFBFBD><18>':<3A>;<3B><04>rc<00>(<00>d|_|j|j<00>|jd<02>|j|jd<00>|jd<04>|jd<05>|j|jd<00>|jd<07>|j|j<00>|jd<08>|j|j
j <00><00>|j|j<00>y) Nrr`rJzYour other information:r_rIzlIMPORTANT - test scenario (Please determine the values of input signals according to these test scenarios.):z#below is the given testbench codes:)rarKr]r r[r<><00> gen_templaterr1s rrLzStage4_SEQ.make_prompt<70>s<><00><00><18><04> <0B> <0C><1C><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>'<27> <0C><1C><1C>]<5D>+<2B> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>H<EFBFBD>5<>6<> <0C><1C><1C>6<>7<> <0C><1C><1C>?<3F>@<40> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>M<EFBFBD>:<3A>;<3B> <0C><1C><1C>L<02> M<02> <0C><1C><1C>T<EFBFBD>1<>1<>2<> <0C><1C><1C>B<>C<> <0C><1C><1C>T<EFBFBD>0<>0<>=<3D>=<3D>?<3F>@<40> <0C><1C><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>'rc<00><><00>|j|jd<01>d|_|j|_tj|j<00>|_yrN)rQr$<00> TB_code_outr<00> verilog_patchr1s rrSzStage4_SEQ.postprocessing sF<00><00><1C>)<29>)<29>$<24>-<2D>-<2D><19>C<>B<EFBFBD>G<><04> <0A> <20>=<3D>=<3D><04><18> <20>.<2E>.<2E>t<EFBFBD>/?<3F>/?<3F>@<40><04>rrJc<00><><00>tj|<00>}d}d}|D]}|d|d<00>d<04>z }|d|d<00><00>z }<04>|rd|zdz|zdz}|Sd|zdz|zdz}|S) aB
- header: the header of DUT
- only: None: both input signal and output signal; "input": only input signal; "output": only output signal
- from header to signals in txt
- for the automatic generation of signals in testbench
- target: given the DUT header, generate the signal output template
- eg: if we have a DUT header like "module DUT(input clk, load, data, output q);", the signal output template should be like "$fdisplay(file, "scenario: %d, clk = %d, load = %d, data = %d, q = %d", scenario, clk, load, data, q);"
rrn<00>namez = %dz$$fdisplay(file, "[check]scenario: %dz ", scenarioz);z$fdisplay(file, "scenario: %d)r<00>extract_signals)rJryrr<00> signal_form1<6D> signal_form2rs<00>txts rruz'Stage4_SEQ.header_to_SignalTxt_templates<><00><00><18>'<27>'<27><06>/<2F><07><19> <0C><19> <0C><1D> 2<>F<EFBFBD> <18>b<EFBFBD><16><06><1E> 0<><05>6<> 6<>L<EFBFBD> <18>b<EFBFBD><16><06><1E> 0<>1<> 1<>L<EFBFBD> 2<> <14>9<>L<EFBFBD>H<>><3E>Y<>\h<>h<>kp<6B>p<>C<EFBFBD><13>
<EFBFBD>3<>\<5C>A<>N<EFBFBD>R<>Ua<55>a<>di<64>i<>C<EFBFBD><12>
rrT)F) r;r<r=r>rrLrS<00> staticmethodr@rurBrCs@rr(r(<00>s1<00><><00>X<> <<3C>(<28>(A<01><12><13>C<EFBFBD><13><12>rr(z6given the scenario based verilog testbench code below:a0
please help me to export the input of DUT module by using code below:
[IMPORTANT]:
%s
you should insert the code above into scenario checking part. In each scenario, you should insert the code above after the input of DUT module changed. Don't delete the existing $display codes.
For example, for a circuit that has two input signals changed at different times in one scenario, the original code is like this:
- original code:
// scenario 1 begins
scenario = 1;
signal_1 = 1;
// insert $fdisplay here
#10;
signal_2 = 1;
// insert $fdisplay here
#10;
$fdisplay(file, "[check]scenario: %%d, signal_1 = %%d, signal_2 = %%d", scenario, signal_1, signal_2); // this should be reserved. Never change the existing codes.
#10;
// scenario 1 ends
- after insertion:
// scenario 1 begins
scenario = 1;
signal_1 = 1;
$fdisplay(file, "scenario: %%d, signal_1 = %%d, signal_2 = %%d", scenario, signal_1, signal_2);
#10;
signal_2 = 1;
$fdisplay(file, "scenario: %%d, signal_1 = %%d, signal_2 = %%d", scenario, signal_1, signal_2);
#10;
$fdisplay(file, "[check]scenario: %%d, signal_1 = %%d, signal_2 = %%d", scenario, signal_1, signal_2);
#10;
// scenario 1 ends
please insert codes according to the rules above. DO NOT modify other codes! please reply the modified full codes. please only reply verilog codes, no other words.c<00>,<00><00>eZdZd<04>fd<01> Zd<02>Zd<03>Z<05>xZS)r-c <00><><00><01>t<00>|<00>di|<03><01>|d|_tj |dd<02><03>}||_t |_tjt|<04>|_ |j
|_ y)NrJFrx)<01>stage_4b) rrrJr(rur+<00>Stage4b_SEQ_TXT1r]<00>Stage4b_SEQ_TXT2r}r~rr<>)rr r+r<00>signals_input_templaters <20>rrzStage4b_SEQ.__init__Psl<00><><00> <0A><07><18>1<>y<EFBFBD>1<><1F><08>)<29><04> <0B>!+<2B>!H<>!H<><19>S[<5B>I\<5C>gl<67>!H<>!m<><1E><1E><04> <0C>$<24><04> <09>$<24>,<2C>,<2C>-E<>G]<5D>^<5E><04> <09><1F><<3C><<3C><04>rc<00><><00>d|_|j|j<00>|j|j<00>|j|j<00>y)Nr)rarKr]r+rr1s rrLzStage4b_SEQ.make_promptYs?<00><00><18><04> <0B> <0C><1C><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>'<27> <0C><1C><1C>T<EFBFBD>\<5C>\<5C>*<2A> <0C><1C><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>'rc<00><><00>|j|jd<01>d|_tj|j|j
<00>|_yrN)rQr$r<>r<00> pychecker_SEQ_TB_standardizationrJr1s rrSzStage4b_SEQ.postprocessing_sB<00><00><1F>,<2C>,<2C>T<EFBFBD>]<5D>]<5D>I<EFBFBD>F<>r<EFBFBD>J<><04><18> <20>A<>A<>$<24>BR<42>BR<42>TX<54>T_<54>T_<54>`<60><04>rrTrVrCs@rr-r-Os<00><><00>(<28>(<28> arr-aW
1. background: Your task is to verify the functional correctness of a verilog RTL module code (we call it as "DUT", device under test). This module is a sequential circuit. Our plan is to first export the signals (input and output) of the DUT under test scenarios. Then, we will use a python script to check the correctness of DUT.
2. You are in stage 5. In this stage, we already exported the signals of DUT. The signals are like below: (the signal names are real, but the values are just for example, clock signals are not included, each vector represents a new clock cycle)
%s
Here's the explanation of some special signals in signal vectors:
- "scenario": The "scenario" is not DUT's signal but to tell you the current scenario index.
- "check_en": The "check_en" signal is not from the DUT. "Check_en" is a bool value to tell you this is the time to check the output of DUT. It is related to the class method "check" (we will explain it later). After checking the output, a new scenario will start.
3. Your current task is: write a python class "GoldenDUT". This python class can represent the golden DUT (the ideal one). In your "GoldenDUT", you should do the following things:
- 3.1. write a method "def __init__(self)". Set the inner states/values of the golden DUT. These values have suffix "_reg". The initial value of these inner values is "x", but later will be digits. The "__init__" method has no input parameters except "self".
- 3.2. write a method "def load(self, signal_vector)". This method is to load the important input signals and the inner values of "GoldenDUT" shall change according to the input signals. There is no clock signal in the input signal vector, every time the "load" method is called, it means a new clock cycle. The initial values "x" should be changed according to the input signals. This method has no return value.
- 3.3. write a method "def check(self, signal_vector)". This method is to determine the expected output values and compare them with output signals from DUT. It should return True or False only. If return false, please print the error message. Hint: you can use code like "print(f"Scenario: {signal_vector['scenario']}, expected: a={a_reg}, observed a={a_observed}")" to print, suppose "a" is the output signal's name.
- 3.4. write other methods you need, they can be called by "load" or "check".
- 3.5. the input of "load" and "check" is the signal vector. The signal vector is a dictionary, the key is the signal name, the value is the signal value.
4. Other information:
- You can use binary (like 0x1101), hexadecimal (like 0x1a) or normal number format in python.
- if the bit width of one variable is limited, use bit mask to assure the correctness of the value.
- you can import numpy, math, scipy or other python libraries to help you write the python class.
5. You have the information below to help you check the correctness of DUT:
a<EFBFBD>
[IMPORTANT]
I will repeat the important information:
3. Your current task is: write a python class "GoldenDUT". This python class can represent the golden DUT (the ideal one). In your "GoldenDUT", you should do the following things:
- 3.1. write a method "def __init__(self)". Set the inner states/values of the golden DUT. These values have suffix "_reg". The initial value of these inner values should be digits. You can set the initial values according to information or just "0"s. The "__init__" method has no input parameters except "self".
- 3.2. write a method "def load(self, signal_vector)". This method is to load the important input signals and the inner values of "GoldenDUT" shall change according to the input signals. There is no clock signal in the input signal vector, every time the "load" method is called, it means a new clock cycle. The initial values "x" should be changed according to the input signals. This method has no return value.
- 3.3. write a method "def check(self, signal_vector)". This method is to determine the expected output values and compare them with output signals from DUT. It should return True or False only. If return false, please print the error message. Hint: you can use code like "print(f"Scenario: {signal_vector['scenario']}, expected: a={a_reg}, observed a={a_observed}")" to print, suppose "a" is the output signal's name.
- 3.4. write other methods you need, they can be called by "load" or "check".
- 3.5. the input of "load" and "check" is the signal vector. The signal vector is a dictionary, the key is the signal name, the value is the signal value.
4. Other information:
- You can use binary (like 0x1101), hexadecimal (like 0x1a) or normal number format in python.
- if the bit width of one variable is limited, use bit mask to assure the correctness of the value.
- you can import numpy, math, scipy or other python libraries to help you write the python class.
please only reply the python codes of the python class. no other words.
a<EFBFBD>
def check_dut(vectors_in):
golden_dut = GoldenDUT()
failed_scenarios = []
for vector in vectors_in:
if vector["check_en"]:
check_pass = golden_dut.check(vector)
if check_pass:
print(f"Passed; vector: {vector}")
else:
print(f"Failed; vector: {vector}")
failed_scenarios.append(vector["scenario"])
golden_dut.load(vector)
return failed_scenarios
a<EFBFBD>
def SignalTxt_to_dictlist(txt:str):
signals = []
lines = txt.strip().split("\n")
for line in lines:
signal = {}
if line.startswith("[check]"):
signal["check_en"] = True
line = line[7:]
elif line.startswith("scenario"):
signal["check_en"] = False
else:
continue
line = line.strip().split(", ")
for item in line:
if "scenario" in item:
item = item.split(": ")
signal["scenario"] = item[1].replace(" ", "")
else:
item = item.split(" = ")
key = item[0]
value = item[1]
if ("x" not in value) and ("X" not in value) and ("z" not in value):
signal[key] = int(value)
else:
if ("x" in value) or ("X" in value):
signal[key] = 0 # used to be "x"
else:
signal[key] = 0 # used to be "z"
signals.append(signal)
return signals
with open("TBout.txt", "r") as f:
txt = f.read()
vectors_in = SignalTxt_to_dictlist(txt)
tb_pass = check_dut(vectors_in)
print(tb_pass)
c<00>0<00><00>eZdZdZd<05>fd<02> Zd<03>Zd<04>Z<06>xZS)r/znstage 5 (SEQ): generate the pychecker that receive the signals from testbench and check the correctness of DUTc <00><><00><01>t<00>|<00>di|<04><01>||_||_||_t
j ttj|dd<02><03><00>|_
t|_ ttz|_y)NrJT)<01> exclude_clk)<01>stage_5)rrr rZ<00>response_stage3<65>STAGE5_SEQ_TXT1r}r~r<00>signal_dictlist_templater]<00>STAGE5_SEQ_TXT2r<00>STAGE5_SEQ_CODE1<45>STAGE5_SEQ_CODE2<45> code_tail)rr rZr<>rrs <20>rrzStage5_SEQ.__init__<5F>ss<00><><00> <0A><07><18>0<>i<EFBFBD>0<>"<22><04><0E>.<2E><04><1C>.<2E><04><1C>#<23>+<2B>+<2B>,D<>e<EFBFBD>Fd<46>Fd<46>en<65>ow<6F>ex<65>GK<02>GL<02>M<02><04> <09>#<23><04> <09>)<29>,<<3C><<3C><04>rc<00><><00>d|_|j|j<00>|jd<02>|j|jd<00>|jd<04>|j|jd<00>|jd<06>|j|j<00>|j|j
<00>y)Nrz DUT circuit problem description:rIz6The header of DUT (note the input and output signals):rJz<>Here is the basic rules in python for the module. It was generated in previous stage. You can use it as a reference, but you should write your own python script. This is just for your better understanding. You can use them or not in your python class)rarKr]r r<>rr1s rrLzStage5_SEQ.make_prompt<70>s<><00><00><18><04> <0B> <0C><1C><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>'<27> <0C><1C><1C>?<3F>@<40> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>M<EFBFBD>:<3A>;<3B> <0C><1C><1C>U<>V<> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>H<EFBFBD>5<>6<> <0C><1C><1C>Z<04> [<04> <0C><1C><1C>T<EFBFBD>1<>1<>2<> <0C><1C><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>'rc<00><><00>|j|jd<01>d|_|j|jz|_y)NrcrP)rQr$r<><00>Pychecker_code_outr1s rrSzStage5_SEQ.postprocessing<6E>s4<00><00><1C>)<29>)<29>$<24>-<2D>-<2D><18>B<>2<EFBFBD>F<><04> <0A>"&<26>-<2D>-<2D>$<24>.<2E>.<2E>"@<40><04>rrT)r;r<r=r>rrLrSrBrCs@rr/r/<00>s<00><><00>x<>=<3D>(<28> Arr/c<00>H<00><00>eZdZdedededdf<08>fd<06> Zd<07>Zd<08>Zd <09>Zd
<EFBFBD>Z <09>xZ
S) r*r+<00> checklist_str<74>max_iterrUNc <00><><00><01>t<00>|<00>di|<04><01>||_tj|<02>|_g|_||_||_d|_ d|_
d|_ y)NFr)<01>stage_checklist) rrr<00>json<6F>loads<64>checklist_dict<63>missing_scenariosr<73>r<><00>exit<69>iter<65> TB_modified)rr+r<>r<>rrs <20>rrzStageChecklist.__init__<5F>sX<00><><00> <0A><07><18>8<>i<EFBFBD>8<>&<26><04><0E>"<22>j<EFBFBD>j<EFBFBD><1D>7<><04><1B>!#<23><04><1E> <20><04> <0A>"<22><04><18><19><04> <09><15><04> <09> <20><04>rc<00>|<00>d|_|jd<02>|jd<03>|j|jdz<00>|jd<05>|j|j<00>|jd<06>|jdt |j
<00>z<00>|jd<08>y) NrzOplease check the if the testbench code contains all the items in the checklist:ztestbench code here...
rdzYplease check the if the testbench code above contains all the scenarios in the checklist:z<>please reply 'YES' if all the items are included. If some of the items are missed in testbench, please add the missing items and reply the modified testbench code (full code).z$HINT: the missing scenarios may be: ziVERY IMPORTANT: please ONLY reply 'YES' or the full code modified. NEVER remove other irrelevant codes!!!)rarKr<>rr@r<>r1s rrLzStageChecklist.make_prompt<70>s<><00><00><18><04> <0B> <0C><1C><1C>n<>o<> <0C><1C><1C>7<>8<> <0C><1C><1C>T<EFBFBD>-<2D>-<2D><04>4<>5<> <0C><1C><1C>x<>y<> <0C><1C><1C>T<EFBFBD>^<5E>^<5E>,<2C> <0C><1C><1C>O<03> P<03> <0C><1C><1C>C<>c<EFBFBD>$<24>J`<60>J`<60>Fa<46>a<>b<> <0C><1C><1C>I<02> Jrc<00><><00>|xjdz c_d|jvrd|_yd|_|j |jd<04>d|_y)Nr<00>YESTrOrP)r<>r$r<>r<>rQr<>r1s rrSzStageChecklist.postprocessing<6E>sH<00><00> <0C> <09> <09>Q<EFBFBD><0E> <09> <10>D<EFBFBD>M<EFBFBD>M<EFBFBD> !<21><1C>D<EFBFBD>I<EFBFBD>#<23>D<EFBFBD> <1C>#<23>0<>0<><14><1D><1D> <09>J<>2<EFBFBD>N<>D<EFBFBD> rc<00><><00>g|_|jj<00>D]<}|jdd<02>|jvs<01>"|jj |<01><00>>y)z\this function is called at the beginning of run() so that the stage can be skipped if neededrmroN)r<>r<><00>keysr}r<><00>append)r<00>keys r<00> pre_checkzStageChecklist.pre_check<63>sU<00><00>!#<23><04><1E><17>&<26>&<26>+<2B>+<2B>-<2D> 3<>C<EFBFBD><12>{<7B>{<7B>3<EFBFBD><05>&<26>d<EFBFBD>.><3E>.><3E>><3E><14>&<26>&<26>-<2D>-<2D>c<EFBFBD>2<> 3rc<00><><00>d|_|js<>|j|jkr<>|j <00>|j
gk(rd|_|xj dz c_n0|j<00>|j<00>|j<00>|js|j|jkr<01><>yyyy)NFTzh
[SYSTEM PRECHECK] All scenarios are included in the testbench code. You can continue to the next stage.)
r<EFBFBD>r<>r<>r<>r<>r<><00>conversation_messagerL<00>call_gptrSr1s r<00>runzStageChecklist.runs<><00><00> <20><04><18><17>9<EFBFBD>9<EFBFBD>4<EFBFBD>9<EFBFBD>9<EFBFBD>t<EFBFBD>}<7D>}<7D>#<<3C> <10>N<EFBFBD>N<EFBFBD> <1C><13>%<25>%<25><12>+<2B> <20><04> <09><14>)<29>)<29>.Y<02>Y<02>)<29><14> <20> <20>"<22><14> <0A> <0A><0F><14>#<23>#<23>%<25><18>9<EFBFBD>9<EFBFBD>4<EFBFBD>9<EFBFBD>9<EFBFBD>t<EFBFBD>}<7D>}<7D>#<<3C>9<EFBFBD>#<<3C>9r) r;r<r=r@<00>intrrLrSr<>r<>rBrCs@rr*r*<00>s;<00><><00> !<21>s<EFBFBD> !<21>#<23> !<21><03> !<21>UY<55> !<21> J<02>O<01>3<>
&rr*)<02>1<>0)r><00> base_scriptrr<00>legacyrrrrr<>r
rr~<00>SIGNALTEMP_PLACEHOLDER_1A<31>SIGNALTEMP_PLACEHOLDER_1Br\r&r@rur{r|r(r<>r<>r-r<>r<>r<>r<>r/r*<00>rr<00><module>r<>s<00><01><04>5<>)<29><13><1B> <0B>5_<01>z<EFBFBD>5_<01>nF<01>_<EFBFBD>F<01>$5<><18>6<><19>6<><19> <1B> <0B> !<21>_<EFBFBD> !<21>D<16><03><16>3<EFBFBD><16>Y\<5C><16>(<04><0F>`<1E>7<>%9<><0F>&?<13><1F>?<13>FP<01><10>#g<02>FiA<03>G#B<03><10>Ha<01>/<2F>a<01>*<04>$<1E>%<1F><0F>(<04><0F>"<04><10> $<04><10>JA<01><1F>A<01>B0&<26>_<EFBFBD>0&r